Command.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. // These classes use a keybinding system based on the design implemented in Scintilla.Net which is an
  2. // MIT licensed open source project https://github.com/jacobslusser/ScintillaNET/blob/master/src/ScintillaNET/Command.cs
  3. namespace Terminal.Gui;
  4. /// <summary>Actions which can be performed by the application or bound to keys in a <see cref="View"/> control.</summary>
  5. public enum Command
  6. {
  7. #region Default View Commands
  8. /// <summary>Invoked when the HotKey for the View has been pressed.</summary>
  9. HotKey,
  10. /// <summary>Accepts the current state (e.g. list selection, button press, toggle, etc.).</summary>
  11. Accept,
  12. /// <summary>Selects an item (e.g. a list item or menu item) without necessarily accepting it.</summary>
  13. Select,
  14. #endregion
  15. #region Movement Commands
  16. /// <summary>Moves up one (cell, line, etc...).</summary>
  17. Up,
  18. /// <summary>Moves down one item (cell, line, etc...).</summary>
  19. Down,
  20. /// <summary>
  21. /// Moves left one (cell, line, etc...).
  22. /// </summary>
  23. Left,
  24. /// <summary>
  25. /// Moves right one (cell, line, etc...).
  26. /// </summary>
  27. Right,
  28. /// <summary>Move one page up.</summary>
  29. PageUp,
  30. /// <summary>Move one page down.</summary>
  31. PageDown,
  32. /// <summary>Moves to the left page.</summary>
  33. PageLeft,
  34. /// <summary>Moves to the right page.</summary>
  35. PageRight,
  36. /// <summary>Moves to the top of page.</summary>
  37. StartOfPage,
  38. /// <summary>Moves to the bottom of page.</summary>
  39. EndOfPage,
  40. /// <summary>Moves to the start (e.g. the top or home).</summary>
  41. Start,
  42. /// <summary>Moves to the end (e.g. the bottom).</summary>
  43. End,
  44. /// <summary>Moves left to the start on the current row/line.</summary>
  45. LeftStart,
  46. /// <summary>Moves right to the end on the current row/line.</summary>
  47. RightEnd,
  48. /// <summary>Moves to the start of the previous word.</summary>
  49. WordLeft,
  50. /// <summary>Moves the start of the next word.</summary>
  51. WordRight,
  52. #endregion
  53. #region Movement With Extension Commands
  54. /// <summary>Extends the selection up one item (cell, line, etc...).</summary>
  55. UpExtend,
  56. /// <summary>Extends the selection down one (cell, line, etc...).</summary>
  57. DownExtend,
  58. /// <summary>
  59. /// Extends the selection left one item (cell, line, etc...)
  60. /// </summary>
  61. LeftExtend,
  62. /// <summary>
  63. /// Extends the selection right one item (cell, line, etc...)
  64. /// </summary>
  65. RightExtend,
  66. /// <summary>Extends the selection to the start of the previous word.</summary>
  67. WordLeftExtend,
  68. /// <summary>Extends the selection to the start of the next word.</summary>
  69. WordRightExtend,
  70. /// <summary>Move one page down extending the selection to cover revealed objects/characters.</summary>
  71. PageDownExtend,
  72. /// <summary>Move one page up extending the selection to cover revealed objects/characters.</summary>
  73. PageUpExtend,
  74. /// <summary>Extends the selection to start (e.g. home or top).</summary>
  75. StartExtend,
  76. /// <summary>Extends the selection to end (e.g. bottom).</summary>
  77. EndExtend,
  78. /// <summary>Extends the selection to the start on the current row/line.</summary>
  79. LeftStartExtend,
  80. /// <summary>Extends the selection to the right on the current row/line.</summary>
  81. RightEndExtend,
  82. /// <summary>Toggles the selection.</summary>
  83. ToggleExtend,
  84. #endregion
  85. #region Editing Commands
  86. /// <summary>Deletes the characters forwards.</summary>
  87. KillWordForwards,
  88. /// <summary>Deletes the characters backwards.</summary>
  89. KillWordBackwards,
  90. /// <summary>
  91. /// Toggles overwrite mode such that newly typed text overwrites the text that is already there (typically
  92. /// associated with the Insert key).
  93. /// </summary>
  94. ToggleOverwrite,
  95. // QUESTION: What is the difference between EnableOverwrite and ToggleOverwrite?
  96. /// <summary>
  97. /// Enables overwrite mode such that newly typed text overwrites the text that is already there (typically
  98. /// associated with the Insert key).
  99. /// </summary>
  100. EnableOverwrite,
  101. /// <summary>Disables overwrite mode (<see cref="EnableOverwrite"/>)</summary>
  102. DisableOverwrite,
  103. /// <summary>Deletes the character on the right.</summary>
  104. DeleteCharRight,
  105. /// <summary>Deletes the character on the left.</summary>
  106. DeleteCharLeft,
  107. /// <summary>Selects all objects.</summary>
  108. SelectAll,
  109. /// <summary>Deletes all objects.</summary>
  110. DeleteAll,
  111. /// <summary>Inserts a new item.</summary>
  112. NewLine,
  113. /// <summary>Unix emulation.</summary>
  114. UnixEmulation,
  115. #endregion
  116. #region Tree Commands
  117. /// <summary>Moves down to the last child node of the branch that holds the current selection.</summary>
  118. LineDownToLastBranch,
  119. /// <summary>Moves up to the first child node of the branch that holds the current selection.</summary>
  120. LineUpToFirstBranch,
  121. #endregion
  122. #region Scroll Commands
  123. /// <summary>Scrolls down one (cell, line, etc...).</summary>
  124. ScrollDown,
  125. /// <summary>Scrolls up one item (cell, line, etc...).</summary>
  126. ScrollUp,
  127. /// <summary>Scrolls one item (cell, character, etc...) to the left.</summary>
  128. ScrollLeft,
  129. /// <summary>Scrolls one item (cell, character, etc...) to the right.</summary>
  130. ScrollRight,
  131. #endregion
  132. #region Clipboard Commands
  133. /// <summary>Undo changes.</summary>
  134. Undo,
  135. /// <summary>Redo changes.</summary>
  136. Redo,
  137. /// <summary>Copies the current selection.</summary>
  138. Copy,
  139. /// <summary>Cuts the current selection.</summary>
  140. Cut,
  141. /// <summary>Pastes the current selection.</summary>
  142. Paste,
  143. /// <summary>Cuts to the clipboard the characters from the current position to the end of the line.</summary>
  144. CutToEndLine,
  145. /// <summary>Cuts to the clipboard the characters from the current position to the start of the line.</summary>
  146. CutToStartLine,
  147. #endregion
  148. #region Navigation Commands
  149. /// <summary>Moves focus to the next <see cref="TabBehavior.TabStop"/>.</summary>
  150. NextTabStop,
  151. /// <summary>Moves focus to the previous <see cref="TabBehavior.TabStop"/>.</summary>
  152. PreviousTabStop,
  153. /// <summary>Moves focus to the next <see cref="TabBehavior.TabGroup"/>.</summary>
  154. NextTabGroup,
  155. /// <summary>Moves focus to the next<see cref="TabBehavior.TabGroup"/>.</summary>
  156. PreviousTabGroup,
  157. /// <summary>Tabs to the next item.</summary>
  158. Tab,
  159. /// <summary>Tabs back to the previous item.</summary>
  160. BackTab,
  161. #endregion
  162. #region Action Commands
  163. /// <summary>Toggles something (e.g. the expanded or collapsed state of a list).</summary>
  164. Toggle,
  165. /// <summary>Expands a list or item (with subitems).</summary>
  166. Expand,
  167. /// <summary>Recursively Expands all child items and their child items (if any).</summary>
  168. ExpandAll,
  169. /// <summary>Collapses a list or item (with subitems).</summary>
  170. Collapse,
  171. /// <summary>Recursively collapses a list items of their children (if any).</summary>
  172. CollapseAll,
  173. /// <summary>Cancels an action or any temporary states on the control e.g. expanding a combo list.</summary>
  174. Cancel,
  175. /// <summary>Quit.</summary>
  176. Quit,
  177. /// <summary>Refresh.</summary>
  178. Refresh,
  179. /// <summary>Suspend an application (Only implemented in <see cref="CursesDriver"/>).</summary>
  180. Suspend,
  181. /// <summary>Open the selected item or invoke a UI for opening something.</summary>
  182. Open,
  183. /// <summary>Saves the current document.</summary>
  184. Save,
  185. /// <summary>Saves the current document with a new name.</summary>
  186. SaveAs,
  187. /// <summary>Creates a new document.</summary>
  188. New,
  189. /// <summary>Shows context about the item (e.g. a context menu).</summary>
  190. Context,
  191. /// <summary>
  192. /// Invokes a user interface for editing or configuring something.
  193. /// </summary>
  194. Edit,
  195. #endregion
  196. }