Skip to content

Fixes #5308. Add editor-oriented Command enum values (Find, Replace, InsertTab, Unindent, FindNext, FindPrevious)#5309

Merged
tig merged 2 commits into
developfrom
copilot/add-command-enum-values
May 14, 2026
Merged

Fixes #5308. Add editor-oriented Command enum values (Find, Replace, InsertTab, Unindent, FindNext, FindPrevious)#5309
tig merged 2 commits into
developfrom
copilot/add-command-enum-values

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

Fixes

The Command enum lacks values needed by text-editing views. Editor projects must handle find/replace and indentation via direct key comparison instead of the KeyBindings system.

Proposed Changes/Todos

  • Add InsertTab and Unindent to the Editing Commands region
  • Add new Search Commands region with Find, FindNext, FindPrevious, Replace
  • Add tests verifying the new values are defined and distinct

New commands:

Command Description
Find Opens or activates a find/search UI
FindNext Finds the next match
FindPrevious Finds the previous match
Replace Opens or activates a find-and-replace UI
InsertTab Inserts a tab character or spaces at the cursor/selection
Unindent Removes one level of indentation from the current line/selection

These are enum-only additions — no views bind to them yet. Views like TextView, TableView, or external editors can now bind keys to these commands via KeyBindings.Add instead of raw key checks:

KeyBindings.Add (Key.Tab, Command.InsertTab);
KeyBindings.Add (Key.Tab.WithShift, Command.Unindent);
KeyBindings.Add (Key.F.WithCtrl, Command.Find);
KeyBindings.Add (Key.H.WithCtrl, Command.Replace);
KeyBindings.Add (Key.F3, Command.FindNext);
KeyBindings.Add (Key.F3.WithShift, Command.FindPrevious);

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

…indent, FindNext, FindPrevious)

Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/3f2e1211-f321-47a0-b237-0e41645ca77a

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copilot AI changed the title [WIP] Add editor-oriented Command enum values for find and replace Fixes #3979. Add editor-oriented Command enum values (Find, Replace, InsertTab, Unindent, FindNext, FindPrevious) May 14, 2026
Copilot finished work on behalf of tig May 14, 2026 20:14
Copilot AI requested a review from tig May 14, 2026 20:14
@tig tig changed the title Fixes #3979. Add editor-oriented Command enum values (Find, Replace, InsertTab, Unindent, FindNext, FindPrevious) Fixes #5308. Add editor-oriented Command enum values (Find, Replace, InsertTab, Unindent, FindNext, FindPrevious) May 14, 2026
@tig tig requested review from BDisp and Copilot May 14, 2026 20:28
@tig tig marked this pull request as ready for review May 14, 2026 20:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds six new editor-oriented values to the Command enum (InsertTab, Unindent, Find, FindNext, FindPrevious, Replace) so editor-style views can route these actions through the KeyBindings system rather than raw key checks. A new "Search Commands" region groups the find/replace entries; indentation entries go into the existing Editing region. No view bindings are added in this PR — it is a pure enum surface extension.

Changes:

  • Add InsertTab and Unindent to the Editing Commands region in Command.cs.
  • Add a new Search Commands region with Find, FindNext, FindPrevious, Replace.
  • Add a new test file asserting the new enum values are defined and distinct.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Terminal.Gui/Input/Command.cs Adds the six new enum members and the Search Commands region.
Tests/UnitTestsParallelizable/Input/CommandEnumTests.cs New tests verifying the new Command values exist and are distinct.

@tig tig merged commit 5cc4b7f into develop May 14, 2026
17 checks passed
@tig tig deleted the copilot/add-command-enum-values branch May 14, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add editor-oriented Command enum values (Find, Replace, InsertTab, Unindent, FindNext, FindPrevious)

4 participants