Skip to content

Commit 5cc4b7f

Browse files
authored
Merge pull request #5309 from gui-cs/copilot/add-command-enum-values
Fixes #5308. Add editor-oriented Command enum values (Find, Replace, InsertTab, Unindent, FindNext, FindPrevious)
2 parents c301f28 + 286986d commit 5cc4b7f

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

Terminal.Gui/Input/Command.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,28 @@ public enum Command
214214
/// <summary>Unix emulation.</summary>
215215
UnixEmulation,
216216

217+
/// <summary>Inserts a tab character or spaces at the cursor or selection.</summary>
218+
InsertTab,
219+
220+
/// <summary>Removes one level of indentation from the current line or selection.</summary>
221+
Unindent,
222+
223+
#endregion
224+
225+
#region Search Commands
226+
227+
/// <summary>Opens or activates a find/search UI.</summary>
228+
Find,
229+
230+
/// <summary>Finds the next match.</summary>
231+
FindNext,
232+
233+
/// <summary>Finds the previous match.</summary>
234+
FindPrevious,
235+
236+
/// <summary>Opens or activates a find-and-replace UI.</summary>
237+
Replace,
238+
217239
#endregion
218240

219241
#region Tree Commands
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copilot
2+
3+
using Terminal.Gui.Input;
4+
5+
namespace UnitTestsParallelizable.Input;
6+
7+
public class CommandEnumTests
8+
{
9+
[Fact]
10+
public void EditorCommands_AreDefined ()
11+
{
12+
// Verify the editor-oriented Command enum values exist and are distinct
13+
Command [] editorCommands =
14+
[
15+
Command.Find,
16+
Command.FindNext,
17+
Command.FindPrevious,
18+
Command.Replace,
19+
Command.InsertTab,
20+
Command.Unindent
21+
];
22+
23+
// All values should be distinct
24+
Assert.Equal (editorCommands.Length, editorCommands.Distinct ().Count ());
25+
}
26+
27+
[Theory]
28+
[InlineData (Command.Find)]
29+
[InlineData (Command.FindNext)]
30+
[InlineData (Command.FindPrevious)]
31+
[InlineData (Command.Replace)]
32+
[InlineData (Command.InsertTab)]
33+
[InlineData (Command.Unindent)]
34+
public void EditorCommand_IsDefined (Command command)
35+
{
36+
Assert.True (Enum.IsDefined (command));
37+
}
38+
}

0 commit comments

Comments
 (0)