diff --git a/Terminal.Gui/Application/Application.Keyboard.cs b/Terminal.Gui/Application/Application.Keyboard.cs index 74411b09b..6addb6c4d 100644 --- a/Terminal.Gui/Application/Application.Keyboard.cs +++ b/Terminal.Gui/Application/Application.Keyboard.cs @@ -282,7 +282,7 @@ public static partial class Application // Keyboard handling // Things this view knows how to do AddCommand ( - Command.QuitToplevel, // TODO: IRunnable: Rename to Command.Quit to make more generic. + Command.Quit, // TODO: IRunnable: Rename to Command.Quit to make more generic. static () => { if (ApplicationOverlapped.OverlappedTop is { }) @@ -309,15 +309,15 @@ public static partial class Application // Keyboard handling ); AddCommand ( - Command.NextView, + Command.NextTabStop, static () => Navigation?.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabStop)); AddCommand ( - Command.PreviousView, + Command.PreviousTabStop, static () => Navigation?.AdvanceFocus (NavigationDirection.Backward, TabBehavior.TabStop)); AddCommand ( - Command.NextViewOrTop, + Command.NextTabGroup, static () => { // TODO: This OverlapppedTop tomfoolery goes away in addressing #2491 @@ -333,7 +333,7 @@ public static partial class Application // Keyboard handling ); AddCommand ( - Command.PreviousViewOrTop, + Command.PreviousTabGroup, static () => { // TODO: This OverlapppedTop tomfoolery goes away in addressing #2491 @@ -386,17 +386,17 @@ public static partial class Application // Keyboard handling QuitKey = Key.Esc; ArrangeKey = Key.F5.WithCtrl; - KeyBindings.Add (QuitKey, KeyBindingScope.Application, Command.QuitToplevel); + KeyBindings.Add (QuitKey, KeyBindingScope.Application, Command.Quit); - KeyBindings.Add (Key.CursorRight, KeyBindingScope.Application, Command.NextView); - KeyBindings.Add (Key.CursorDown, KeyBindingScope.Application, Command.NextView); - KeyBindings.Add (Key.CursorLeft, KeyBindingScope.Application, Command.PreviousView); - KeyBindings.Add (Key.CursorUp, KeyBindingScope.Application, Command.PreviousView); - KeyBindings.Add (NextTabKey, KeyBindingScope.Application, Command.NextView); - KeyBindings.Add (PrevTabKey, KeyBindingScope.Application, Command.PreviousView); + KeyBindings.Add (Key.CursorRight, KeyBindingScope.Application, Command.NextTabStop); + KeyBindings.Add (Key.CursorDown, KeyBindingScope.Application, Command.NextTabStop); + KeyBindings.Add (Key.CursorLeft, KeyBindingScope.Application, Command.PreviousTabStop); + KeyBindings.Add (Key.CursorUp, KeyBindingScope.Application, Command.PreviousTabStop); + KeyBindings.Add (NextTabKey, KeyBindingScope.Application, Command.NextTabStop); + KeyBindings.Add (PrevTabKey, KeyBindingScope.Application, Command.PreviousTabStop); - KeyBindings.Add (NextTabGroupKey, KeyBindingScope.Application, Command.NextViewOrTop); - KeyBindings.Add (PrevTabGroupKey, KeyBindingScope.Application, Command.PreviousViewOrTop); + KeyBindings.Add (NextTabGroupKey, KeyBindingScope.Application, Command.NextTabGroup); + KeyBindings.Add (PrevTabGroupKey, KeyBindingScope.Application, Command.PreviousTabGroup); KeyBindings.Add (ArrangeKey, KeyBindingScope.Application, Command.Edit); diff --git a/Terminal.Gui/Input/Command.cs b/Terminal.Gui/Input/Command.cs index 2eaba7c0d..4aac4a6a1 100644 --- a/Terminal.Gui/Input/Command.cs +++ b/Terminal.Gui/Input/Command.cs @@ -6,88 +6,123 @@ namespace Terminal.Gui; /// Actions which can be performed by the application or bound to keys in a control. public enum Command { + #region Default View Commands + /// Invoked when the HotKey for the View has been pressed. HotKey, - /// Accepts the current state (e.g. list selection, button press, toggle, etc). + /// Accepts the current state (e.g. list selection, button press, toggle, etc.). Accept, /// Selects an item (e.g. a list item or menu item) without necessarily accepting it. Select, - /// Moves down one item (cell, line, etc...). - LineDown, + #endregion - /// Extends the selection down one (cell, line, etc...). - LineDownExtend, - - /// Moves down to the last child node of the branch that holds the current selection. - LineDownToLastBranch, - - /// Scrolls down one (cell, line, etc...) (without changing the selection). - ScrollDown, - - // -------------------------------------------------------------------- + #region Movement Commands /// Moves up one (cell, line, etc...). - LineUp, + Up, - /// Extends the selection up one item (cell, line, etc...). - LineUpExtend, - - /// Moves up to the first child node of the branch that holds the current selection. - LineUpToFirstBranch, - - /// Scrolls up one item (cell, line, etc...) (without changing the selection). - ScrollUp, + /// Moves down one item (cell, line, etc...). + Down, /// - /// Moves the selection left one by the minimum increment supported by the e.g. single - /// character, cell, item etc. + /// Moves left one (cell, line, etc...). /// Left, - /// Scrolls one item (cell, character, etc...) to the left - ScrollLeft, + /// + /// Moves right one (cell, line, etc...). + /// + Right, + + /// Move one page up. + PageUp, + + /// Move one page down. + PageDown, + + /// Moves to the left page. + PageLeft, + + /// Moves to the right page. + PageRight, + + /// Moves to the top of page. + StartOfPage, + + /// Moves to the bottom of page. + EndOfPage, + + /// Moves to the start (e.g. the top or home). + Start, + + /// Moves to the end (e.g. the bottom). + End, + + /// Moves left to the start on the current row/line. + LeftStart, + + /// Moves right to the end on the current row/line. + RightEnd, + + /// Moves to the start of the previous word. + WordLeft, + + /// Moves the start of the next word. + WordRight, + + #endregion + + #region Movement With Extension Commands + + /// Extends the selection up one item (cell, line, etc...). + UpExtend, + + /// Extends the selection down one (cell, line, etc...). + DownExtend, /// - /// Extends the selection left one by the minimum increment supported by the view e.g. single character, cell, - /// item etc. + /// Extends the selection left one item (cell, line, etc...) /// LeftExtend, /// - /// Moves the selection right one by the minimum increment supported by the view e.g. single character, cell, item - /// etc. - /// - Right, - - /// Scrolls one item (cell, character, etc...) to the right. - ScrollRight, - - /// - /// Extends the selection right one by the minimum increment supported by the view e.g. single character, cell, - /// item etc. + /// Extends the selection right one item (cell, line, etc...) /// RightExtend, - /// Moves the caret to the start of the previous word. - WordLeft, - /// Extends the selection to the start of the previous word. WordLeftExtend, - /// Moves the caret to the start of the next word. - WordRight, - /// Extends the selection to the start of the next word. WordRightExtend, - /// Cuts to the clipboard the characters from the current position to the end of the line. - CutToEndLine, + /// Move one page down extending the selection to cover revealed objects/characters. + PageDownExtend, - /// Cuts to the clipboard the characters from the current position to the start of the line. - CutToStartLine, + /// Move one page up extending the selection to cover revealed objects/characters. + PageUpExtend, + + /// Extends the selection to start (e.g. home or top). + StartExtend, + + /// Extends the selection to end (e.g. bottom). + EndExtend, + + /// Extends the selection to the start on the current row/line. + LeftStartExtend, + + /// Extends the selection to the right on the current row/line. + RightEndExtend, + + /// Toggles the selection. + ToggleExtend, + + #endregion + + #region Editing Commands /// Deletes the characters forwards. KillWordForwards, @@ -101,6 +136,8 @@ public enum Command /// ToggleOverwrite, + // QUESTION: What is the difference between EnableOverwrite and ToggleOverwrite? + /// /// Enables overwrite mode such that newly typed text overwrites the text that is already there (typically /// associated with the Insert key). @@ -110,54 +147,6 @@ public enum Command /// Disables overwrite mode () DisableOverwrite, - /// Move one page down. - PageDown, - - /// Move one page down extending the selection to cover revealed objects/characters. - PageDownExtend, - - /// Move one page up. - PageUp, - - /// Move one page up extending the selection to cover revealed objects/characters. - PageUpExtend, - - /// Moves to the top/home. - TopHome, - - /// Extends the selection to the top/home. - TopHomeExtend, - - /// Moves to the bottom/end. - BottomEnd, - - /// Extends the selection to the bottom/end. - BottomEndExtend, - - /// Open the selected item. - OpenSelectedItem, - - /// Toggles the Expanded or collapsed state of a list or item (with subitems). - ToggleExpandCollapse, - - /// Expands a list or item (with subitems). - Expand, - - /// Recursively Expands all child items and their child items (if any). - ExpandAll, - - /// Collapses a list or item (with subitems). - Collapse, - - /// Recursively collapses a list items of their children (if any). - CollapseAll, - - /// Cancels an action or any temporary states on the control e.g. expanding a combo list. - Cancel, - - /// Unix emulation. - UnixEmulation, - /// Deletes the character on the right. DeleteCharRight, @@ -170,41 +159,41 @@ public enum Command /// Deletes all objects. DeleteAll, - /// Moves the cursor to the start of line. - StartOfLine, + /// Inserts a new item. + NewLine, - /// Extends the selection to the start of line. - StartOfLineExtend, + /// Unix emulation. + UnixEmulation, - /// Moves the cursor to the end of line. - EndOfLine, + #endregion - /// Extends the selection to the end of line. - EndOfLineExtend, + #region Tree Commands - /// Moves the cursor to the top of page. - StartOfPage, + /// Moves down to the last child node of the branch that holds the current selection. + LineDownToLastBranch, - /// Moves the cursor to the bottom of page. - EndOfPage, + /// Moves up to the first child node of the branch that holds the current selection. + LineUpToFirstBranch, - /// Moves to the left page. - PageLeft, + #endregion - /// Moves to the right page. - PageRight, + #region Scroll Commands - /// Moves to the left begin. - LeftHome, + /// Scrolls down one (cell, line, etc...). + ScrollDown, - /// Extends the selection to the left begin. - LeftHomeExtend, + /// Scrolls up one item (cell, line, etc...). + ScrollUp, - /// Moves to the right end. - RightEnd, + /// Scrolls one item (cell, character, etc...) to the left. + ScrollLeft, - /// Extends the selection to the right end. - RightEndExtend, + /// Scrolls one item (cell, character, etc...) to the right. + ScrollRight, + + #endregion + + #region Clipboard Commands /// Undo changes. Undo, @@ -221,35 +210,27 @@ public enum Command /// Pastes the current selection. Paste, - /// TODO: IRunnable: Rename to Command.Quit to make more generic. - /// Quit a . - QuitToplevel, + /// Cuts to the clipboard the characters from the current position to the end of the line. + CutToEndLine, - /// TODO: Overlapped: Add Command.ShowHide + /// Cuts to the clipboard the characters from the current position to the start of the line. + CutToStartLine, - /// Suspend an application (Only implemented in ). - Suspend, + #endregion - /// Moves focus to the next view. - NextView, + #region Navigation Commands - /// Moves focus to the previous view. - PreviousView, + /// Moves focus to the next . + NextTabStop, - /// Moves focus to the next view or Toplevel (case of Overlapped). - NextViewOrTop, + /// Moves focus to the previous . + PreviousTabStop, - /// Moves focus to the next previous or Toplevel (case of Overlapped). - PreviousViewOrTop, + /// Moves focus to the next . + NextTabGroup, - /// Refresh. - Refresh, - - /// Toggles the selection. - ToggleExtend, - - /// Inserts a new item. - NewLine, + /// Moves focus to the next. + PreviousTabGroup, /// Tabs to the next item. Tab, @@ -257,6 +238,40 @@ public enum Command /// Tabs back to the previous item. BackTab, + #endregion + + #region Action Commands + + /// Toggles something (e.g. the expanded or collapsed state of a list). + Toggle, + + /// Expands a list or item (with subitems). + Expand, + + /// Recursively Expands all child items and their child items (if any). + ExpandAll, + + /// Collapses a list or item (with subitems). + Collapse, + + /// Recursively collapses a list items of their children (if any). + CollapseAll, + + /// Cancels an action or any temporary states on the control e.g. expanding a combo list. + Cancel, + + /// Quit. + Quit, + + /// Refresh. + Refresh, + + /// Suspend an application (Only implemented in ). + Suspend, + + /// Open the selected item or invoke a UI for opening something. + Open, + /// Saves the current document. Save, @@ -267,10 +282,12 @@ public enum Command New, /// Shows context about the item (e.g. a context menu). - ShowContextMenu, + Context, /// - /// Invokes a user interface for editing. + /// Invokes a user interface for editing or configuring something. /// - Edit + Edit, + + #endregion } diff --git a/Terminal.Gui/View/Adornment/Border.cs b/Terminal.Gui/View/Adornment/Border.cs index 05070d887..f54132f67 100644 --- a/Terminal.Gui/View/Adornment/Border.cs +++ b/Terminal.Gui/View/Adornment/Border.cs @@ -754,9 +754,9 @@ public class Border : Adornment }; Add (_arrangeButton); - AddCommand (Command.QuitToplevel, EndArrange); + AddCommand (Command.Quit, EndArrange); - AddCommand (Command.LineUp, + AddCommand (Command.Up, () => { if (_arranging == ViewArrangement.Movable) @@ -775,7 +775,7 @@ public class Border : Adornment return true; }); - AddCommand (Command.LineDown, + AddCommand (Command.Down, () => { if (_arranging == ViewArrangement.Movable) @@ -853,10 +853,10 @@ public class Border : Adornment return true; }); - KeyBindings.Add (Key.Esc, KeyBindingScope.HotKey, Command.QuitToplevel); - KeyBindings.Add (Application.ArrangeKey, KeyBindingScope.HotKey, Command.QuitToplevel); - KeyBindings.Add (Key.CursorUp, KeyBindingScope.HotKey, Command.LineUp); - KeyBindings.Add (Key.CursorDown, KeyBindingScope.HotKey, Command.LineDown); + KeyBindings.Add (Key.Esc, KeyBindingScope.HotKey, Command.Quit); + KeyBindings.Add (Application.ArrangeKey, KeyBindingScope.HotKey, Command.Quit); + KeyBindings.Add (Key.CursorUp, KeyBindingScope.HotKey, Command.Up); + KeyBindings.Add (Key.CursorDown, KeyBindingScope.HotKey, Command.Down); KeyBindings.Add (Key.CursorLeft, KeyBindingScope.HotKey, Command.Left); KeyBindings.Add (Key.CursorRight, KeyBindingScope.HotKey, Command.Right); diff --git a/Terminal.Gui/Views/ColorBar.cs b/Terminal.Gui/Views/ColorBar.cs index 54dc54cb6..066ad72b2 100644 --- a/Terminal.Gui/Views/ColorBar.cs +++ b/Terminal.Gui/Views/ColorBar.cs @@ -23,14 +23,14 @@ internal abstract class ColorBar : View, IColorBar AddCommand (Command.LeftExtend, _ => Adjust (-MaxValue / 20)); AddCommand (Command.RightExtend, _ => Adjust (MaxValue / 20)); - AddCommand (Command.LeftHome, _ => SetZero ()); + AddCommand (Command.LeftStart, _ => SetZero ()); AddCommand (Command.RightEnd, _ => SetMax ()); KeyBindings.Add (Key.CursorLeft, Command.Left); KeyBindings.Add (Key.CursorRight, Command.Right); KeyBindings.Add (Key.CursorLeft.WithShift, Command.LeftExtend); KeyBindings.Add (Key.CursorRight.WithShift, Command.RightExtend); - KeyBindings.Add (Key.Home, Command.LeftHome); + KeyBindings.Add (Key.Home, Command.LeftStart); KeyBindings.Add (Key.End, Command.RightEnd); } diff --git a/Terminal.Gui/Views/ColorPicker16.cs b/Terminal.Gui/Views/ColorPicker16.cs index 7312f113b..c5351b8ef 100644 --- a/Terminal.Gui/Views/ColorPicker16.cs +++ b/Terminal.Gui/Views/ColorPicker16.cs @@ -166,8 +166,8 @@ public class ColorPicker16 : View { AddCommand (Command.Left, () => MoveLeft ()); AddCommand (Command.Right, () => MoveRight ()); - AddCommand (Command.LineUp, () => MoveUp ()); - AddCommand (Command.LineDown, () => MoveDown ()); + AddCommand (Command.Up, () => MoveUp ()); + AddCommand (Command.Down, () => MoveDown ()); } /// Add the KeyBindinds. @@ -175,8 +175,8 @@ public class ColorPicker16 : View { KeyBindings.Add (Key.CursorLeft, Command.Left); KeyBindings.Add (Key.CursorRight, Command.Right); - KeyBindings.Add (Key.CursorUp, Command.LineUp); - KeyBindings.Add (Key.CursorDown, Command.LineDown); + KeyBindings.Add (Key.CursorUp, Command.Up); + KeyBindings.Add (Key.CursorDown, Command.Down); } // TODO: Decouple Cursor from SelectedColor so that mouse press-and-hold can show the color under the cursor. diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index bfd207aa7..69c1b65d2 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -77,27 +77,27 @@ public class ComboBox : View, IDesignable // Things this view knows how to do AddCommand (Command.Accept, () => ActivateSelected ()); - AddCommand (Command.ToggleExpandCollapse, () => ExpandCollapse ()); + AddCommand (Command.Toggle, () => ExpandCollapse ()); AddCommand (Command.Expand, () => Expand ()); AddCommand (Command.Collapse, () => Collapse ()); - AddCommand (Command.LineDown, () => MoveDown ()); - AddCommand (Command.LineUp, () => MoveUp ()); + AddCommand (Command.Down, () => MoveDown ()); + AddCommand (Command.Up, () => MoveUp ()); AddCommand (Command.PageDown, () => PageDown ()); AddCommand (Command.PageUp, () => PageUp ()); - AddCommand (Command.TopHome, () => MoveHome ()); - AddCommand (Command.BottomEnd, () => MoveEnd ()); + AddCommand (Command.Start, () => MoveHome ()); + AddCommand (Command.End, () => MoveEnd ()); AddCommand (Command.Cancel, () => CancelSelected ()); AddCommand (Command.UnixEmulation, () => UnixEmulation ()); // Default keybindings for this view KeyBindings.Add (Key.Enter, Command.Accept); - KeyBindings.Add (Key.F4, Command.ToggleExpandCollapse); - KeyBindings.Add (Key.CursorDown, Command.LineDown); - KeyBindings.Add (Key.CursorUp, Command.LineUp); + KeyBindings.Add (Key.F4, Command.Toggle); + KeyBindings.Add (Key.CursorDown, Command.Down); + KeyBindings.Add (Key.CursorUp, Command.Up); KeyBindings.Add (Key.PageDown, Command.PageDown); KeyBindings.Add (Key.PageUp, Command.PageUp); - KeyBindings.Add (Key.Home, Command.TopHome); - KeyBindings.Add (Key.End, Command.BottomEnd); + KeyBindings.Add (Key.Home, Command.Start); + KeyBindings.Add (Key.End, Command.End); KeyBindings.Add (Key.Esc, Command.Cancel); KeyBindings.Add (Key.U.WithCtrl, Command.UnixEmulation); } @@ -992,7 +992,7 @@ public class ComboBox : View, IDesignable "ComboBox container cannot be null." ); HideDropdownListOnClick = hideDropdownListOnClick; - AddCommand (Command.LineUp, () => _container.MoveUpList ()); + AddCommand (Command.Up, () => _container.MoveUpList ()); } } diff --git a/Terminal.Gui/Views/DateField.cs b/Terminal.Gui/Views/DateField.cs index 0bb3d9ad2..2e07f0afa 100644 --- a/Terminal.Gui/Views/DateField.cs +++ b/Terminal.Gui/Views/DateField.cs @@ -395,7 +395,7 @@ public class DateField : TextField return true; } ); - AddCommand (Command.LeftHome, () => MoveHome ()); + AddCommand (Command.LeftStart, () => MoveHome ()); AddCommand (Command.Left, () => MoveLeft ()); AddCommand (Command.RightEnd, () => MoveEnd ()); AddCommand (Command.Right, () => MoveRight ()); @@ -406,8 +406,8 @@ public class DateField : TextField KeyBindings.ReplaceCommands (Key.Backspace, Command.DeleteCharLeft); - KeyBindings.ReplaceCommands (Key.Home, Command.LeftHome); - KeyBindings.ReplaceCommands (Key.A.WithCtrl, Command.LeftHome); + KeyBindings.ReplaceCommands (Key.Home, Command.LeftStart); + KeyBindings.ReplaceCommands (Key.A.WithCtrl, Command.LeftStart); KeyBindings.ReplaceCommands (Key.CursorLeft, Command.Left); KeyBindings.ReplaceCommands (Key.B.WithCtrl, Command.Left); diff --git a/Terminal.Gui/Views/FileDialog.cs b/Terminal.Gui/Views/FileDialog.cs index 00f07a16c..6510a8036 100644 --- a/Terminal.Gui/Views/FileDialog.cs +++ b/Terminal.Gui/Views/FileDialog.cs @@ -236,10 +236,10 @@ public class FileDialog : Dialog _tableView.KeyUp += (s, k) => k.Handled = TableView_KeyUp (k); _tableView.SelectedCellChanged += TableView_SelectedCellChanged; - _tableView.KeyBindings.ReplaceCommands (Key.Home, Command.TopHome); - _tableView.KeyBindings.ReplaceCommands (Key.End, Command.BottomEnd); - _tableView.KeyBindings.ReplaceCommands (Key.Home.WithShift, Command.TopHomeExtend); - _tableView.KeyBindings.ReplaceCommands (Key.End.WithShift, Command.BottomEndExtend); + _tableView.KeyBindings.ReplaceCommands (Key.Home, Command.Start); + _tableView.KeyBindings.ReplaceCommands (Key.End, Command.End); + _tableView.KeyBindings.ReplaceCommands (Key.Home.WithShift, Command.StartExtend); + _tableView.KeyBindings.ReplaceCommands (Key.End.WithShift, Command.EndExtend); AllowsMultipleSelection = false; diff --git a/Terminal.Gui/Views/HexView.cs b/Terminal.Gui/Views/HexView.cs index 49228ecc9..a79a5cc32 100644 --- a/Terminal.Gui/Views/HexView.cs +++ b/Terminal.Gui/Views/HexView.cs @@ -59,15 +59,15 @@ public class HexView : View // Things this view knows how to do AddCommand (Command.Left, () => MoveLeft ()); AddCommand (Command.Right, () => MoveRight ()); - AddCommand (Command.LineDown, () => MoveDown (bytesPerLine)); - AddCommand (Command.LineUp, () => MoveUp (bytesPerLine)); + AddCommand (Command.Down, () => MoveDown (bytesPerLine)); + AddCommand (Command.Up, () => MoveUp (bytesPerLine)); AddCommand (Command.Accept, () => ToggleSide ()); AddCommand (Command.PageUp, () => MoveUp (bytesPerLine * Frame.Height)); AddCommand (Command.PageDown, () => MoveDown (bytesPerLine * Frame.Height)); - AddCommand (Command.TopHome, () => MoveHome ()); - AddCommand (Command.BottomEnd, () => MoveEnd ()); - AddCommand (Command.StartOfLine, () => MoveStartOfLine ()); - AddCommand (Command.EndOfLine, () => MoveEndOfLine ()); + AddCommand (Command.Start, () => MoveHome ()); + AddCommand (Command.End, () => MoveEnd ()); + AddCommand (Command.LeftStart, () => MoveLeftStart ()); + AddCommand (Command.RightEnd, () => MoveEndOfLine ()); AddCommand (Command.StartOfPage, () => MoveUp (bytesPerLine * ((int)(position - displayStart) / bytesPerLine))); AddCommand ( @@ -78,8 +78,8 @@ public class HexView : View // Default keybindings for this view KeyBindings.Add (Key.CursorLeft, Command.Left); KeyBindings.Add (Key.CursorRight, Command.Right); - KeyBindings.Add (Key.CursorDown, Command.LineDown); - KeyBindings.Add (Key.CursorUp, Command.LineUp); + KeyBindings.Add (Key.CursorDown, Command.Down); + KeyBindings.Add (Key.CursorUp, Command.Up); KeyBindings.Add (Key.Enter, Command.Accept); KeyBindings.Add (Key.V.WithAlt, Command.PageUp); @@ -88,10 +88,10 @@ public class HexView : View KeyBindings.Add (Key.V.WithCtrl, Command.PageDown); KeyBindings.Add (Key.PageDown, Command.PageDown); - KeyBindings.Add (Key.Home, Command.TopHome); - KeyBindings.Add (Key.End, Command.BottomEnd); - KeyBindings.Add (Key.CursorLeft.WithCtrl, Command.StartOfLine); - KeyBindings.Add (Key.CursorRight.WithCtrl, Command.EndOfLine); + KeyBindings.Add (Key.Home, Command.Start); + KeyBindings.Add (Key.End, Command.End); + KeyBindings.Add (Key.CursorLeft.WithCtrl, Command.LeftStart); + KeyBindings.Add (Key.CursorRight.WithCtrl, Command.RightEnd); KeyBindings.Add (Key.CursorUp.WithCtrl, Command.StartOfPage); KeyBindings.Add (Key.CursorDown.WithCtrl, Command.EndOfPage); @@ -728,7 +728,7 @@ public class HexView : View return true; } - private bool MoveStartOfLine () + private bool MoveLeftStart () { position = position / bytesPerLine * bytesPerLine; SetNeedsDisplay (); diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs index 2c1571780..c887879b9 100644 --- a/Terminal.Gui/Views/ListView.cs +++ b/Terminal.Gui/Views/ListView.cs @@ -124,39 +124,39 @@ public class ListView : View, IDesignable // Things this view knows how to do // // BUGBUG: SHould return false if selectokn doesn't change (to support nav to next view) - AddCommand (Command.LineUp, () => MoveUp ()); + AddCommand (Command.Up, () => MoveUp ()); // BUGBUG: SHould return false if selectokn doesn't change (to support nav to next view) - AddCommand (Command.LineDown, () => MoveDown ()); + AddCommand (Command.Down, () => MoveDown ()); AddCommand (Command.ScrollUp, () => ScrollVertical (-1)); AddCommand (Command.ScrollDown, () => ScrollVertical (1)); AddCommand (Command.PageUp, () => MovePageUp ()); AddCommand (Command.PageDown, () => MovePageDown ()); - AddCommand (Command.TopHome, () => MoveHome ()); - AddCommand (Command.BottomEnd, () => MoveEnd ()); + AddCommand (Command.Start, () => MoveHome ()); + AddCommand (Command.End, () => MoveEnd ()); AddCommand (Command.Accept, () => OnOpenSelectedItem ()); - AddCommand (Command.OpenSelectedItem, () => OnOpenSelectedItem ()); + AddCommand (Command.Open, () => OnOpenSelectedItem ()); AddCommand (Command.Select, () => MarkUnmarkRow ()); AddCommand (Command.ScrollLeft, () => ScrollHorizontal (-1)); AddCommand (Command.ScrollRight, () => ScrollHorizontal (1)); // Default keybindings for all ListViews - KeyBindings.Add (Key.CursorUp, Command.LineUp); - KeyBindings.Add (Key.P.WithCtrl, Command.LineUp); + KeyBindings.Add (Key.CursorUp, Command.Up); + KeyBindings.Add (Key.P.WithCtrl, Command.Up); - KeyBindings.Add (Key.CursorDown, Command.LineDown); - KeyBindings.Add (Key.N.WithCtrl, Command.LineDown); + KeyBindings.Add (Key.CursorDown, Command.Down); + KeyBindings.Add (Key.N.WithCtrl, Command.Down); KeyBindings.Add (Key.PageUp, Command.PageUp); KeyBindings.Add (Key.PageDown, Command.PageDown); KeyBindings.Add (Key.V.WithCtrl, Command.PageDown); - KeyBindings.Add (Key.Home, Command.TopHome); + KeyBindings.Add (Key.Home, Command.Start); - KeyBindings.Add (Key.End, Command.BottomEnd); + KeyBindings.Add (Key.End, Command.End); - KeyBindings.Add (Key.Enter, Command.OpenSelectedItem); + KeyBindings.Add (Key.Enter, Command.Open); } /// Gets or sets whether this allows items to be marked. diff --git a/Terminal.Gui/Views/Menu/Menu.cs b/Terminal.Gui/Views/Menu/Menu.cs index 9fcf3fd4c..d251a382a 100644 --- a/Terminal.Gui/Views/Menu/Menu.cs +++ b/Terminal.Gui/Views/Menu/Menu.cs @@ -153,8 +153,8 @@ internal sealed class Menu : View Application.MouseEvent += Application_RootMouseEvent; // Things this view knows how to do - AddCommand (Command.LineUp, () => MoveUp ()); - AddCommand (Command.LineDown, () => MoveDown ()); + AddCommand (Command.Up, () => MoveUp ()); + AddCommand (Command.Down, () => MoveDown ()); AddCommand ( Command.Left, @@ -186,12 +186,12 @@ internal sealed class Menu : View } ); AddCommand (Command.Select, ctx => _host?.SelectItem ((ctx.KeyBinding?.Context as MenuItem)!)); - AddCommand (Command.ToggleExpandCollapse, ctx => ExpandCollapse ((ctx.KeyBinding?.Context as MenuItem)!)); + AddCommand (Command.Toggle, ctx => ExpandCollapse ((ctx.KeyBinding?.Context as MenuItem)!)); AddCommand (Command.HotKey, ctx => _host?.SelectItem ((ctx.KeyBinding?.Context as MenuItem)!)); // Default key bindings for this view - KeyBindings.Add (Key.CursorUp, Command.LineUp); - KeyBindings.Add (Key.CursorDown, Command.LineDown); + KeyBindings.Add (Key.CursorUp, Command.Up); + KeyBindings.Add (Key.CursorDown, Command.Down); KeyBindings.Add (Key.CursorLeft, Command.Left); KeyBindings.Add (Key.CursorRight, Command.Right); KeyBindings.Add (Key.Esc, Command.Cancel); @@ -209,7 +209,7 @@ internal sealed class Menu : View foreach (MenuItem menuItem in menuItems) { - KeyBinding keyBinding = new ([Command.ToggleExpandCollapse], KeyBindingScope.HotKey, menuItem); + KeyBinding keyBinding = new ([Command.Toggle], KeyBindingScope.HotKey, menuItem); if (menuItem.HotKey != Key.Empty) { diff --git a/Terminal.Gui/Views/Menu/MenuBar.cs b/Terminal.Gui/Views/Menu/MenuBar.cs index 76c00ed19..009640c6f 100644 --- a/Terminal.Gui/Views/Menu/MenuBar.cs +++ b/Terminal.Gui/Views/Menu/MenuBar.cs @@ -126,7 +126,7 @@ public class MenuBar : View, IDesignable return true; } ); - AddCommand (Command.ToggleExpandCollapse, ctx => + AddCommand (Command.Toggle, ctx => { CloseOtherOpenedMenuBar (); @@ -147,7 +147,7 @@ public class MenuBar : View, IDesignable KeyBindings.Add (Key.CursorDown, Command.Accept); KeyBindings.Add (Key.Enter, Command.Accept); - KeyBinding keyBinding = new ([Command.ToggleExpandCollapse], KeyBindingScope.HotKey, -1); // -1 indicates Key was used + KeyBinding keyBinding = new ([Command.Toggle], KeyBindingScope.HotKey, -1); // -1 indicates Key was used KeyBindings.Add (Key, keyBinding); // TODO: Why do we have two keybindings for opening the menu? Ctrl-Space and Key? @@ -190,10 +190,10 @@ public class MenuBar : View, IDesignable if (menuBarItem.HotKey != Key.Empty) { KeyBindings.Remove (menuBarItem.HotKey!); - KeyBinding keyBinding = new ([Command.ToggleExpandCollapse], KeyBindingScope.Focused, menuBarItem); + KeyBinding keyBinding = new ([Command.Toggle], KeyBindingScope.Focused, menuBarItem); KeyBindings.Add (menuBarItem.HotKey!, keyBinding); KeyBindings.Remove (menuBarItem.HotKey!.WithAlt); - keyBinding = new ([Command.ToggleExpandCollapse], KeyBindingScope.HotKey, menuBarItem); + keyBinding = new ([Command.Toggle], KeyBindingScope.HotKey, menuBarItem); KeyBindings.Add (menuBarItem.HotKey.WithAlt, keyBinding); } @@ -1272,7 +1272,7 @@ public class MenuBar : View, IDesignable } KeyBindings.Remove (_key); - KeyBinding keyBinding = new ([Command.ToggleExpandCollapse], KeyBindingScope.HotKey, -1); // -1 indicates Key was used + KeyBinding keyBinding = new ([Command.Toggle], KeyBindingScope.HotKey, -1); // -1 indicates Key was used KeyBindings.Add (value, keyBinding); _key = value; } diff --git a/Terminal.Gui/Views/Menu/MenuItem.cs b/Terminal.Gui/Views/Menu/MenuItem.cs index 0c920da52..016cf2875 100644 --- a/Terminal.Gui/Views/Menu/MenuItem.cs +++ b/Terminal.Gui/Views/Menu/MenuItem.cs @@ -325,7 +325,7 @@ public class MenuItem if (index > -1) { _menuBar.KeyBindings.Remove (HotKey!.WithAlt); - KeyBinding keyBinding = new ([Command.ToggleExpandCollapse], KeyBindingScope.HotKey, this); + KeyBinding keyBinding = new ([Command.Toggle], KeyBindingScope.HotKey, this); _menuBar.KeyBindings.Add (HotKey.WithAlt, keyBinding); } } diff --git a/Terminal.Gui/Views/RadioGroup.cs b/Terminal.Gui/Views/RadioGroup.cs index 5c22fa264..e2df1879d 100644 --- a/Terminal.Gui/Views/RadioGroup.cs +++ b/Terminal.Gui/Views/RadioGroup.cs @@ -22,7 +22,7 @@ public class RadioGroup : View, IDesignable, IOrientation // Things this view knows how to do AddCommand ( - Command.LineUp, + Command.Up, () => { if (!HasFocus) @@ -35,7 +35,7 @@ public class RadioGroup : View, IDesignable, IOrientation ); AddCommand ( - Command.LineDown, + Command.Down, () => { if (!HasFocus) @@ -47,7 +47,7 @@ public class RadioGroup : View, IDesignable, IOrientation ); AddCommand ( - Command.TopHome, + Command.Start, () => { if (!HasFocus) @@ -62,7 +62,7 @@ public class RadioGroup : View, IDesignable, IOrientation ); AddCommand ( - Command.BottomEnd, + Command.End, () => { if (!HasFocus) @@ -125,17 +125,17 @@ public class RadioGroup : View, IDesignable, IOrientation // Default keybindings for this view if (Orientation == Orientation.Vertical) { - KeyBindings.Add (Key.CursorUp, Command.LineUp); - KeyBindings.Add (Key.CursorDown, Command.LineDown); + KeyBindings.Add (Key.CursorUp, Command.Up); + KeyBindings.Add (Key.CursorDown, Command.Down); } else { - KeyBindings.Add (Key.CursorLeft, Command.LineUp); - KeyBindings.Add (Key.CursorRight, Command.LineDown); + KeyBindings.Add (Key.CursorLeft, Command.Up); + KeyBindings.Add (Key.CursorRight, Command.Down); } - KeyBindings.Add (Key.Home, Command.TopHome); - KeyBindings.Add (Key.End, Command.BottomEnd); + KeyBindings.Add (Key.Home, Command.Start); + KeyBindings.Add (Key.End, Command.End); KeyBindings.Add (Key.Space, Command.Accept); } diff --git a/Terminal.Gui/Views/ScrollView.cs b/Terminal.Gui/Views/ScrollView.cs index 43de42db5..6a656a648 100644 --- a/Terminal.Gui/Views/ScrollView.cs +++ b/Terminal.Gui/Views/ScrollView.cs @@ -88,9 +88,9 @@ public class ScrollView : View AddCommand (Command.PageDown, () => ScrollDown (Viewport.Height)); AddCommand (Command.PageLeft, () => ScrollLeft (Viewport.Width)); AddCommand (Command.PageRight, () => ScrollRight (Viewport.Width)); - AddCommand (Command.TopHome, () => ScrollUp (GetContentSize ().Height)); - AddCommand (Command.BottomEnd, () => ScrollDown (GetContentSize ().Height)); - AddCommand (Command.LeftHome, () => ScrollLeft (GetContentSize ().Width)); + AddCommand (Command.Start, () => ScrollUp (GetContentSize ().Height)); + AddCommand (Command.End, () => ScrollDown (GetContentSize ().Height)); + AddCommand (Command.LeftStart, () => ScrollLeft (GetContentSize ().Width)); AddCommand (Command.RightEnd, () => ScrollRight (GetContentSize ().Width)); // Default keybindings for this view @@ -107,9 +107,9 @@ public class ScrollView : View KeyBindings.Add (Key.PageUp.WithCtrl, Command.PageLeft); KeyBindings.Add (Key.PageDown.WithCtrl, Command.PageRight); - KeyBindings.Add (Key.Home, Command.TopHome); - KeyBindings.Add (Key.End, Command.BottomEnd); - KeyBindings.Add (Key.Home.WithCtrl, Command.LeftHome); + KeyBindings.Add (Key.Home, Command.Start); + KeyBindings.Add (Key.End, Command.End); + KeyBindings.Add (Key.Home.WithCtrl, Command.LeftStart); KeyBindings.Add (Key.End.WithCtrl, Command.RightEnd); Initialized += (s, e) => diff --git a/Terminal.Gui/Views/Slider.cs b/Terminal.Gui/Views/Slider.cs index 59d464345..b96d96a4a 100644 --- a/Terminal.Gui/Views/Slider.cs +++ b/Terminal.Gui/Views/Slider.cs @@ -1413,10 +1413,10 @@ public class Slider : View, IOrientation private void SetCommands () { AddCommand (Command.Right, () => MovePlus ()); - AddCommand (Command.LineDown, () => MovePlus ()); + AddCommand (Command.Down, () => MovePlus ()); AddCommand (Command.Left, () => MoveMinus ()); - AddCommand (Command.LineUp, () => MoveMinus ()); - AddCommand (Command.LeftHome, () => MoveStart ()); + AddCommand (Command.Up, () => MoveMinus ()); + AddCommand (Command.LeftStart, () => MoveStart ()); AddCommand (Command.RightEnd, () => MoveEnd ()); AddCommand (Command.RightExtend, () => ExtendPlus ()); AddCommand (Command.LeftExtend, () => ExtendMinus ()); @@ -1444,9 +1444,9 @@ public class Slider : View, IOrientation else { KeyBindings.Remove (Key.CursorRight); - KeyBindings.Add (Key.CursorDown, Command.LineDown); + KeyBindings.Add (Key.CursorDown, Command.Down); KeyBindings.Remove (Key.CursorLeft); - KeyBindings.Add (Key.CursorUp, Command.LineUp); + KeyBindings.Add (Key.CursorUp, Command.Up); KeyBindings.Remove (Key.CursorRight.WithCtrl); KeyBindings.Add (Key.CursorDown.WithCtrl, Command.RightExtend); @@ -1455,7 +1455,7 @@ public class Slider : View, IOrientation } KeyBindings.Remove (Key.Home); - KeyBindings.Add (Key.Home, Command.LeftHome); + KeyBindings.Add (Key.Home, Command.LeftStart); KeyBindings.Remove (Key.End); KeyBindings.Add (Key.End, Command.RightEnd); KeyBindings.Remove (Key.Enter); diff --git a/Terminal.Gui/Views/TabView.cs b/Terminal.Gui/Views/TabView.cs index e88ec14bd..3e63dde53 100644 --- a/Terminal.Gui/Views/TabView.cs +++ b/Terminal.Gui/Views/TabView.cs @@ -44,7 +44,7 @@ public class TabView : View AddCommand (Command.Right, () => SwitchTabBy (1)); AddCommand ( - Command.LeftHome, + Command.LeftStart, () => { TabScrollOffset = 0; @@ -90,7 +90,7 @@ public class TabView : View // Default keybindings for this view KeyBindings.Add (Key.CursorLeft, Command.Left); KeyBindings.Add (Key.CursorRight, Command.Right); - KeyBindings.Add (Key.Home, Command.LeftHome); + KeyBindings.Add (Key.Home, Command.LeftStart); KeyBindings.Add (Key.End, Command.RightEnd); KeyBindings.Add (Key.PageDown, Command.PageDown); KeyBindings.Add (Key.PageUp, Command.PageUp); diff --git a/Terminal.Gui/Views/TableView/TableView.cs b/Terminal.Gui/Views/TableView/TableView.cs index ac9ea1113..18a5d7c65 100644 --- a/Terminal.Gui/Views/TableView/TableView.cs +++ b/Terminal.Gui/Views/TableView/TableView.cs @@ -61,11 +61,11 @@ public class TableView : View () => ChangeSelectionByOffsetWithReturn (-1, 0)); AddCommand ( - Command.LineUp, + Command.Up, () => ChangeSelectionByOffsetWithReturn (0, -1)); AddCommand ( - Command.LineDown, + Command.Down, () => ChangeSelectionByOffsetWithReturn (0, 1)); AddCommand ( @@ -89,7 +89,7 @@ public class TableView : View ); AddCommand ( - Command.LeftHome, + Command.LeftStart, () => { ChangeSelectionToStartOfRow (false); @@ -109,7 +109,7 @@ public class TableView : View ); AddCommand ( - Command.TopHome, + Command.Start, () => { ChangeSelectionToStartOfTable (false); @@ -119,7 +119,7 @@ public class TableView : View ); AddCommand ( - Command.BottomEnd, + Command.End, () => { ChangeSelectionToEndOfTable (false); @@ -149,7 +149,7 @@ public class TableView : View ); AddCommand ( - Command.LineUpExtend, + Command.UpExtend, () => { ChangeSelectionByOffset (0, -1, true); @@ -159,7 +159,7 @@ public class TableView : View ); AddCommand ( - Command.LineDownExtend, + Command.DownExtend, () => { ChangeSelectionByOffset (0, 1, true); @@ -189,7 +189,7 @@ public class TableView : View ); AddCommand ( - Command.LeftHomeExtend, + Command.LeftStartExtend, () => { ChangeSelectionToStartOfRow (true); @@ -209,7 +209,7 @@ public class TableView : View ); AddCommand ( - Command.TopHomeExtend, + Command.StartExtend, () => { ChangeSelectionToStartOfTable (true); @@ -219,7 +219,7 @@ public class TableView : View ); AddCommand ( - Command.BottomEndExtend, + Command.EndExtend, () => { ChangeSelectionToEndOfTable (true); @@ -262,25 +262,25 @@ public class TableView : View // Default keybindings for this view KeyBindings.Add (Key.CursorLeft, Command.Left); KeyBindings.Add (Key.CursorRight, Command.Right); - KeyBindings.Add (Key.CursorUp, Command.LineUp); - KeyBindings.Add (Key.CursorDown, Command.LineDown); + KeyBindings.Add (Key.CursorUp, Command.Up); + KeyBindings.Add (Key.CursorDown, Command.Down); KeyBindings.Add (Key.PageUp, Command.PageUp); KeyBindings.Add (Key.PageDown, Command.PageDown); - KeyBindings.Add (Key.Home, Command.LeftHome); + KeyBindings.Add (Key.Home, Command.LeftStart); KeyBindings.Add (Key.End, Command.RightEnd); - KeyBindings.Add (Key.Home.WithCtrl, Command.TopHome); - KeyBindings.Add (Key.End.WithCtrl, Command.BottomEnd); + KeyBindings.Add (Key.Home.WithCtrl, Command.Start); + KeyBindings.Add (Key.End.WithCtrl, Command.End); KeyBindings.Add (Key.CursorLeft.WithShift, Command.LeftExtend); KeyBindings.Add (Key.CursorRight.WithShift, Command.RightExtend); - KeyBindings.Add (Key.CursorUp.WithShift, Command.LineUpExtend); - KeyBindings.Add (Key.CursorDown.WithShift, Command.LineDownExtend); + KeyBindings.Add (Key.CursorUp.WithShift, Command.UpExtend); + KeyBindings.Add (Key.CursorDown.WithShift, Command.DownExtend); KeyBindings.Add (Key.PageUp.WithShift, Command.PageUpExtend); KeyBindings.Add (Key.PageDown.WithShift, Command.PageDownExtend); - KeyBindings.Add (Key.Home.WithShift, Command.LeftHomeExtend); + KeyBindings.Add (Key.Home.WithShift, Command.LeftStartExtend); KeyBindings.Add (Key.End.WithShift, Command.RightEndExtend); - KeyBindings.Add (Key.Home.WithCtrl.WithShift, Command.TopHomeExtend); - KeyBindings.Add (Key.End.WithCtrl.WithShift, Command.BottomEndExtend); + KeyBindings.Add (Key.Home.WithCtrl.WithShift, Command.StartExtend); + KeyBindings.Add (Key.End.WithCtrl.WithShift, Command.EndExtend); KeyBindings.Add (Key.A.WithCtrl, Command.SelectAll); KeyBindings.Add (CellActivationKey, Command.Accept); diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs index da8f42347..400317e6a 100644 --- a/Terminal.Gui/Views/TextField.cs +++ b/Terminal.Gui/Views/TextField.cs @@ -72,7 +72,7 @@ public class TextField : View ); AddCommand ( - Command.LeftHomeExtend, + Command.LeftStartExtend, () => { MoveHomeExtend (); @@ -92,7 +92,7 @@ public class TextField : View ); AddCommand ( - Command.LeftHome, + Command.LeftStart, () => { MoveHome (); @@ -316,7 +316,7 @@ public class TextField : View ); AddCommand ( - Command.ShowContextMenu, + Command.Context, () => { ShowContextMenu (); @@ -336,17 +336,17 @@ public class TextField : View KeyBindings.Add (Key.Backspace, Command.DeleteCharLeft); - KeyBindings.Add (Key.Home.WithShift, Command.LeftHomeExtend); - KeyBindings.Add (Key.Home.WithShift.WithCtrl, Command.LeftHomeExtend); - KeyBindings.Add (Key.A.WithShift.WithCtrl, Command.LeftHomeExtend); + KeyBindings.Add (Key.Home.WithShift, Command.LeftStartExtend); + KeyBindings.Add (Key.Home.WithShift.WithCtrl, Command.LeftStartExtend); + KeyBindings.Add (Key.A.WithShift.WithCtrl, Command.LeftStartExtend); KeyBindings.Add (Key.End.WithShift, Command.RightEndExtend); KeyBindings.Add (Key.End.WithShift.WithCtrl, Command.RightEndExtend); KeyBindings.Add (Key.E.WithShift.WithCtrl, Command.RightEndExtend); - KeyBindings.Add (Key.Home, Command.LeftHome); - KeyBindings.Add (Key.Home.WithCtrl, Command.LeftHome); - KeyBindings.Add (Key.A.WithCtrl, Command.LeftHome); + KeyBindings.Add (Key.Home, Command.LeftStart); + KeyBindings.Add (Key.Home.WithCtrl, Command.LeftStart); + KeyBindings.Add (Key.A.WithCtrl, Command.LeftStart); KeyBindings.Add (Key.CursorLeft.WithShift, Command.LeftExtend); KeyBindings.Add (Key.CursorUp.WithShift, Command.LeftExtend); @@ -408,7 +408,7 @@ public class TextField : View ContextMenu = new ContextMenu { Host = this }; ContextMenu.KeyChanged += ContextMenu_KeyChanged; - KeyBindings.Add (ContextMenu.Key, KeyBindingScope.HotKey, Command.ShowContextMenu); + KeyBindings.Add (ContextMenu.Key, KeyBindingScope.HotKey, Command.Context); KeyBindings.Add (Key.Enter, Command.Accept); } diff --git a/Terminal.Gui/Views/TextValidateField.cs b/Terminal.Gui/Views/TextValidateField.cs index 7858dba59..a6c740d1b 100644 --- a/Terminal.Gui/Views/TextValidateField.cs +++ b/Terminal.Gui/Views/TextValidateField.cs @@ -401,7 +401,7 @@ namespace Terminal.Gui // Things this view knows how to do AddCommand ( - Command.LeftHome, + Command.LeftStart, () => { HomeKeyHandler (); @@ -461,7 +461,7 @@ namespace Terminal.Gui ); // Default keybindings for this view - KeyBindings.Add (Key.Home, Command.LeftHome); + KeyBindings.Add (Key.Home, Command.LeftStart); KeyBindings.Add (Key.End, Command.RightEnd); KeyBindings.Add (Key.Delete, Command.DeleteCharRight); diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs index 44bfcdf5f..e60c7054b 100644 --- a/Terminal.Gui/Views/TextView.cs +++ b/Terminal.Gui/Views/TextView.cs @@ -2050,10 +2050,10 @@ public class TextView : View } ); - AddCommand (Command.LineDown, () => ProcessMoveDown ()); + AddCommand (Command.Down, () => ProcessMoveDown ()); AddCommand ( - Command.LineDownExtend, + Command.DownExtend, () => { ProcessMoveDownExtend (); @@ -2062,10 +2062,10 @@ public class TextView : View } ); - AddCommand (Command.LineUp, () => ProcessMoveUp ()); + AddCommand (Command.Up, () => ProcessMoveUp ()); AddCommand ( - Command.LineUpExtend, + Command.UpExtend, () => { ProcessMoveUpExtend (); @@ -2107,20 +2107,20 @@ public class TextView : View ); AddCommand ( - Command.StartOfLine, + Command.LeftStart, () => { - ProcessMoveStartOfLine (); + ProcessMoveLeftStart (); return true; } ); AddCommand ( - Command.StartOfLineExtend, + Command.LeftStartExtend, () => { - ProcessMoveStartOfLineExtend (); + ProcessMoveLeftStartExtend (); return true; } @@ -2137,7 +2137,7 @@ public class TextView : View ); AddCommand ( - Command.EndOfLine, + Command.RightEnd, () => { ProcessMoveEndOfLine (); @@ -2147,10 +2147,10 @@ public class TextView : View ); AddCommand ( - Command.EndOfLineExtend, + Command.RightEndExtend, () => { - ProcessMoveEndOfLineExtend (); + ProcessMoveRightEndExtend (); return true; } @@ -2170,7 +2170,7 @@ public class TextView : View Command.CutToStartLine, () => { - KillToStartOfLine (); + KillToLeftStart (); return true; } @@ -2278,7 +2278,7 @@ public class TextView : View AddCommand (Command.NewLine, () => ProcessReturn ()); AddCommand ( - Command.BottomEnd, + Command.End, () => { MoveBottomEnd (); @@ -2288,7 +2288,7 @@ public class TextView : View ); AddCommand ( - Command.BottomEndExtend, + Command.EndExtend, () => { MoveBottomEndExtend (); @@ -2298,7 +2298,7 @@ public class TextView : View ); AddCommand ( - Command.TopHome, + Command.Start, () => { MoveTopHome (); @@ -2308,7 +2308,7 @@ public class TextView : View ); AddCommand ( - Command.TopHomeExtend, + Command.StartExtend, () => { MoveTopHomeExtend (); @@ -2390,7 +2390,7 @@ public class TextView : View ); AddCommand ( - Command.ShowContextMenu, + Command.Context, () => { ContextMenu!.Position = new ( @@ -2414,15 +2414,15 @@ public class TextView : View KeyBindings.Add (Key.PageUp.WithShift, Command.PageUpExtend); - KeyBindings.Add (Key.N.WithCtrl, Command.LineDown); - KeyBindings.Add (Key.CursorDown, Command.LineDown); + KeyBindings.Add (Key.N.WithCtrl, Command.Down); + KeyBindings.Add (Key.CursorDown, Command.Down); - KeyBindings.Add (Key.CursorDown.WithShift, Command.LineDownExtend); + KeyBindings.Add (Key.CursorDown.WithShift, Command.DownExtend); - KeyBindings.Add (Key.P.WithCtrl, Command.LineUp); - KeyBindings.Add (Key.CursorUp, Command.LineUp); + KeyBindings.Add (Key.P.WithCtrl, Command.Up); + KeyBindings.Add (Key.CursorUp, Command.Up); - KeyBindings.Add (Key.CursorUp.WithShift, Command.LineUpExtend); + KeyBindings.Add (Key.CursorUp.WithShift, Command.UpExtend); KeyBindings.Add (Key.F.WithCtrl, Command.Right); KeyBindings.Add (Key.CursorRight, Command.Right); @@ -2436,18 +2436,18 @@ public class TextView : View KeyBindings.Add (Key.Backspace, Command.DeleteCharLeft); - KeyBindings.Add (Key.Home, Command.StartOfLine); - KeyBindings.Add (Key.A.WithCtrl, Command.StartOfLine); + KeyBindings.Add (Key.Home, Command.LeftStart); + KeyBindings.Add (Key.A.WithCtrl, Command.LeftStart); - KeyBindings.Add (Key.Home.WithShift, Command.StartOfLineExtend); + KeyBindings.Add (Key.Home.WithShift, Command.LeftStartExtend); KeyBindings.Add (Key.Delete, Command.DeleteCharRight); KeyBindings.Add (Key.D.WithCtrl, Command.DeleteCharRight); - KeyBindings.Add (Key.End, Command.EndOfLine); - KeyBindings.Add (Key.E.WithCtrl, Command.EndOfLine); + KeyBindings.Add (Key.End, Command.RightEnd); + KeyBindings.Add (Key.E.WithCtrl, Command.RightEnd); - KeyBindings.Add (Key.End.WithShift, Command.EndOfLineExtend); + KeyBindings.Add (Key.End.WithShift, Command.RightEndExtend); KeyBindings.Add (Key.K.WithCtrl, Command.CutToEndLine); // kill-to-end @@ -2481,10 +2481,10 @@ public class TextView : View // BUGBUG: If AllowsReturn is false, Key.Enter should not be bound (so that Toplevel can cause Command.Accept). KeyBindings.Add (Key.Enter, Command.NewLine); - KeyBindings.Add (Key.End.WithCtrl, Command.BottomEnd); - KeyBindings.Add (Key.End.WithCtrl.WithShift, Command.BottomEndExtend); - KeyBindings.Add (Key.Home.WithCtrl, Command.TopHome); - KeyBindings.Add (Key.Home.WithCtrl.WithShift, Command.TopHomeExtend); + KeyBindings.Add (Key.End.WithCtrl, Command.End); + KeyBindings.Add (Key.End.WithCtrl.WithShift, Command.EndExtend); + KeyBindings.Add (Key.Home.WithCtrl, Command.Start); + KeyBindings.Add (Key.Home.WithCtrl.WithShift, Command.StartExtend); KeyBindings.Add (Key.T.WithCtrl, Command.SelectAll); KeyBindings.Add (Key.InsertChar, Command.ToggleOverwrite); KeyBindings.Add (Key.Tab, Command.Tab); @@ -2501,7 +2501,7 @@ public class TextView : View ContextMenu = new (); ContextMenu.KeyChanged += ContextMenu_KeyChanged!; - KeyBindings.Add ((KeyCode)ContextMenu.Key, KeyBindingScope.HotKey, Command.ShowContextMenu); + KeyBindings.Add ((KeyCode)ContextMenu.Key, KeyBindingScope.HotKey, Command.Context); } private void TextView_Added1 (object? sender, SuperViewChangedEventArgs e) @@ -5019,7 +5019,7 @@ public class TextView : View DoNeededAction (); } - private void KillToStartOfLine () + private void KillToLeftStart () { if (_isReadOnly) { @@ -5456,7 +5456,7 @@ public class TextView : View return true; } - private void MoveStartOfLine () + private void MoveLeftStart () { if (_leftColumn > 0) { @@ -5847,7 +5847,7 @@ public class TextView : View MoveEndOfLine (); } - private void ProcessMoveEndOfLineExtend () + private void ProcessMoveRightEndExtend () { ResetAllTrack (); StartSelecting (); @@ -5914,7 +5914,7 @@ public class TextView : View MoveRight (); } - private void ProcessMoveStartOfLine () + private void ProcessMoveLeftStart () { ResetAllTrack (); @@ -5923,14 +5923,14 @@ public class TextView : View StopSelecting (); } - MoveStartOfLine (); + MoveLeftStart (); } - private void ProcessMoveStartOfLineExtend () + private void ProcessMoveLeftStartExtend () { ResetAllTrack (); StartSelecting (); - MoveStartOfLine (); + MoveLeftStart (); } private bool ProcessMoveUp () diff --git a/Terminal.Gui/Views/TileView.cs b/Terminal.Gui/Views/TileView.cs index c6e010d5d..698f67d43 100644 --- a/Terminal.Gui/Views/TileView.cs +++ b/Terminal.Gui/Views/TileView.cs @@ -887,14 +887,14 @@ public class TileView : View AddCommand (Command.Left, () => { return MoveSplitter (-1, 0); }); - AddCommand (Command.LineUp, () => { return MoveSplitter (0, -1); }); + AddCommand (Command.Up, () => { return MoveSplitter (0, -1); }); - AddCommand (Command.LineDown, () => { return MoveSplitter (0, 1); }); + AddCommand (Command.Down, () => { return MoveSplitter (0, 1); }); KeyBindings.Add (Key.CursorRight, Command.Right); KeyBindings.Add (Key.CursorLeft, Command.Left); - KeyBindings.Add (Key.CursorUp, Command.LineUp); - KeyBindings.Add (Key.CursorDown, Command.LineDown); + KeyBindings.Add (Key.CursorUp, Command.Up); + KeyBindings.Add (Key.CursorDown, Command.Down); } public int Idx { get; } diff --git a/Terminal.Gui/Views/TimeField.cs b/Terminal.Gui/Views/TimeField.cs index a473fdcea..b198d66a0 100644 --- a/Terminal.Gui/Views/TimeField.cs +++ b/Terminal.Gui/Views/TimeField.cs @@ -53,7 +53,7 @@ public class TimeField : TextField return true; } ); - AddCommand (Command.LeftHome, () => MoveHome ()); + AddCommand (Command.LeftStart, () => MoveHome ()); AddCommand (Command.Left, () => MoveLeft ()); AddCommand (Command.RightEnd, () => MoveEnd ()); AddCommand (Command.Right, () => MoveRight ()); @@ -64,8 +64,8 @@ public class TimeField : TextField KeyBindings.ReplaceCommands (Key.Backspace, Command.DeleteCharLeft); - KeyBindings.ReplaceCommands (Key.Home, Command.LeftHome); - KeyBindings.ReplaceCommands (Key.A.WithCtrl, Command.LeftHome); + KeyBindings.ReplaceCommands (Key.Home, Command.LeftStart); + KeyBindings.ReplaceCommands (Key.A.WithCtrl, Command.LeftStart); KeyBindings.ReplaceCommands (Key.CursorLeft, Command.Left); KeyBindings.ReplaceCommands (Key.B.WithCtrl, Command.Left); diff --git a/Terminal.Gui/Views/TreeView/TreeView.cs b/Terminal.Gui/Views/TreeView/TreeView.cs index 0468dd873..01a498f96 100644 --- a/Terminal.Gui/Views/TreeView/TreeView.cs +++ b/Terminal.Gui/Views/TreeView/TreeView.cs @@ -163,7 +163,7 @@ public class TreeView : View, ITreeView where T : class ); AddCommand ( - Command.LineUp, + Command.Up, () => { AdjustSelection (-1); @@ -173,7 +173,7 @@ public class TreeView : View, ITreeView where T : class ); AddCommand ( - Command.LineUpExtend, + Command.UpExtend, () => { AdjustSelection (-1, true); @@ -193,7 +193,7 @@ public class TreeView : View, ITreeView where T : class ); AddCommand ( - Command.LineDown, + Command.Down, () => { AdjustSelection (1); @@ -203,7 +203,7 @@ public class TreeView : View, ITreeView where T : class ); AddCommand ( - Command.LineDownExtend, + Command.DownExtend, () => { AdjustSelection (1, true); @@ -223,7 +223,7 @@ public class TreeView : View, ITreeView where T : class ); AddCommand ( - Command.TopHome, + Command.Start, () => { GoToFirst (); @@ -233,7 +233,7 @@ public class TreeView : View, ITreeView where T : class ); AddCommand ( - Command.BottomEnd, + Command.End, () => { GoToEnd (); @@ -285,16 +285,16 @@ public class TreeView : View, ITreeView where T : class KeyBindings.Add (Key.CursorLeft, Command.Collapse); KeyBindings.Add (Key.CursorLeft.WithCtrl, Command.CollapseAll); - KeyBindings.Add (Key.CursorUp, Command.LineUp); - KeyBindings.Add (Key.CursorUp.WithShift, Command.LineUpExtend); + KeyBindings.Add (Key.CursorUp, Command.Up); + KeyBindings.Add (Key.CursorUp.WithShift, Command.UpExtend); KeyBindings.Add (Key.CursorUp.WithCtrl, Command.LineUpToFirstBranch); - KeyBindings.Add (Key.CursorDown, Command.LineDown); - KeyBindings.Add (Key.CursorDown.WithShift, Command.LineDownExtend); + KeyBindings.Add (Key.CursorDown, Command.Down); + KeyBindings.Add (Key.CursorDown.WithShift, Command.DownExtend); KeyBindings.Add (Key.CursorDown.WithCtrl, Command.LineDownToLastBranch); - KeyBindings.Add (Key.Home, Command.TopHome); - KeyBindings.Add (Key.End, Command.BottomEnd); + KeyBindings.Add (Key.Home, Command.Start); + KeyBindings.Add (Key.End, Command.End); KeyBindings.Add (Key.A.WithCtrl, Command.SelectAll); KeyBindings.Add (ObjectActivationKey, Command.Select); } diff --git a/UICatalog/Scenarios/CharacterMap.cs b/UICatalog/Scenarios/CharacterMap.cs index fba3354db..d172f8c52 100644 --- a/UICatalog/Scenarios/CharacterMap.cs +++ b/UICatalog/Scenarios/CharacterMap.cs @@ -419,7 +419,7 @@ internal class CharMap : View ); AddCommand ( - Command.TopHome, + Command.Start, () => { SelectedCodePoint = 0; @@ -429,7 +429,7 @@ internal class CharMap : View ); AddCommand ( - Command.BottomEnd, + Command.End, () => { SelectedCodePoint = MaxCodePoint; @@ -456,8 +456,8 @@ internal class CharMap : View KeyBindings.Add (Key.CursorRight, Command.ScrollRight); KeyBindings.Add (Key.PageUp, Command.PageUp); KeyBindings.Add (Key.PageDown, Command.PageDown); - KeyBindings.Add (Key.Home, Command.TopHome); - KeyBindings.Add (Key.End, Command.BottomEnd); + KeyBindings.Add (Key.Home, Command.Start); + KeyBindings.Add (Key.End, Command.End); MouseClick += Handle_MouseClick; MouseEvent += Handle_MouseEvent; diff --git a/UICatalog/Scenarios/ExpanderButton.cs b/UICatalog/Scenarios/ExpanderButton.cs index bf1622135..05270638f 100644 --- a/UICatalog/Scenarios/ExpanderButton.cs +++ b/UICatalog/Scenarios/ExpanderButton.cs @@ -39,8 +39,8 @@ public class ExpanderButton : Button ShadowStyle = ShadowStyle.None; AddCommand (Command.HotKey, Toggle); - AddCommand (Command.ToggleExpandCollapse, Toggle); - KeyBindings.Add (Key.F4, Command.ToggleExpandCollapse); + AddCommand (Command.Toggle, Toggle); + KeyBindings.Add (Key.F4, Command.Toggle); Orientation = Orientation.Vertical; diff --git a/UICatalog/Scenarios/KeyBindings.cs b/UICatalog/Scenarios/KeyBindings.cs index 2f85aca46..b51fb81fc 100644 --- a/UICatalog/Scenarios/KeyBindings.cs +++ b/UICatalog/Scenarios/KeyBindings.cs @@ -190,12 +190,12 @@ public class KeyBindingsDemo : View KeyBindings.Add (Key.F3, Command.New); // same as specifying KeyBindingScope.Focused Application.KeyBindings.Add (Key.F4, this, Command.New); - AddCommand (Command.QuitToplevel, ctx => + AddCommand (Command.Quit, ctx => { MessageBox.Query ($"{ctx.KeyBinding?.Scope}", $"Key: {ctx.Key}\nCommand: {ctx.Command}", buttons: "Ok"); Application.RequestStop (); return true; }); - Application.KeyBindings.Add (Key.Q.WithAlt, this, Command.QuitToplevel); + Application.KeyBindings.Add (Key.Q.WithAlt, this, Command.Quit); } } diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs index 9168214cf..8968aae65 100644 --- a/UICatalog/UICatalog.cs +++ b/UICatalog/UICatalog.cs @@ -664,9 +664,9 @@ public class UICatalogApp // TableView typically is a grid where nav keys are biased for moving left/right. ScenarioList.KeyBindings.Remove (Key.Home); - ScenarioList.KeyBindings.Add (Key.Home, Command.TopHome); + ScenarioList.KeyBindings.Add (Key.Home, Command.Start); ScenarioList.KeyBindings.Remove (Key.End); - ScenarioList.KeyBindings.Add (Key.End, Command.BottomEnd); + ScenarioList.KeyBindings.Add (Key.End, Command.End); // Ideally, TableView.MultiSelect = false would turn off any keybindings for // multi-select options. But it currently does not. UI Catalog uses Ctrl-A for diff --git a/UnitTests/Input/KeyBindingTests.cs b/UnitTests/Input/KeyBindingTests.cs index 9ef3da07e..fe3d137e7 100644 --- a/UnitTests/Input/KeyBindingTests.cs +++ b/UnitTests/Input/KeyBindingTests.cs @@ -165,7 +165,7 @@ public class KeyBindingTests Command [] commands1 = { Command.Right, Command.Left }; keyBindings.Add (Key.A, KeyBindingScope.Application, commands1); - Command [] commands2 = { Command.LineUp, Command.LineDown }; + Command [] commands2 = { Command.Up, Command.Down }; keyBindings.Add (Key.B, KeyBindingScope.Application, commands2); Key key = keyBindings.GetKeyFromCommands (commands1); @@ -175,7 +175,7 @@ public class KeyBindingTests Assert.Equal (Key.B, key); // Negative case - Assert.Throws (() => key = keyBindings.GetKeyFromCommands (Command.EndOfLine)); + Assert.Throws (() => key = keyBindings.GetKeyFromCommands (Command.RightEnd)); } [Fact] diff --git a/UnitTests/Views/ListViewTests.cs b/UnitTests/Views/ListViewTests.cs index 399dbf9c2..d88c4470d 100644 --- a/UnitTests/Views/ListViewTests.cs +++ b/UnitTests/Views/ListViewTests.cs @@ -504,7 +504,7 @@ Item 6", Assert.Equal (-1, lv.SelectedItem); // bind shift down to move down twice in control - lv.KeyBindings.Add (Key.CursorDown.WithShift, Command.LineDown, Command.LineDown); + lv.KeyBindings.Add (Key.CursorDown.WithShift, Command.Down, Command.Down); Key ev = Key.CursorDown.WithShift; @@ -536,7 +536,7 @@ Item 6", Assert.False (lv.Source.IsMarked (1)); Assert.False (lv.Source.IsMarked (2)); - lv.KeyBindings.Add (Key.Space.WithShift, Command.Select, Command.LineDown); + lv.KeyBindings.Add (Key.Space.WithShift, Command.Select, Command.Down); Key ev = Key.Space.WithShift; diff --git a/UnitTests/Views/TextViewTests.cs b/UnitTests/Views/TextViewTests.cs index 364fb228d..5f5662c29 100644 --- a/UnitTests/Views/TextViewTests.cs +++ b/UnitTests/Views/TextViewTests.cs @@ -1796,7 +1796,7 @@ This is the second line. [Fact] [AutoInitShutdown] - public void HistoryText_Undo_Redo_KillToStartOfLine () + public void HistoryText_Undo_Redo_KillToLeftStart () { var text = "First line.\nSecond line."; var tv = new TextView { Text = text };