2
0

Command.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. /// <summary>The default command. For <see cref="View"/> this focuses the view.</summary>
  8. Default,
  9. /// <summary>Moves down one item (cell, line, etc...).</summary>
  10. LineDown,
  11. /// <summary>Extends the selection down one (cell, line, etc...).</summary>
  12. LineDownExtend,
  13. /// <summary>Moves down to the last child node of the branch that holds the current selection.</summary>
  14. LineDownToLastBranch,
  15. /// <summary>Scrolls down one (cell, line, etc...) (without changing the selection).</summary>
  16. ScrollDown,
  17. // --------------------------------------------------------------------
  18. /// <summary>Moves up one (cell, line, etc...).</summary>
  19. LineUp,
  20. /// <summary>Extends the selection up one item (cell, line, etc...).</summary>
  21. LineUpExtend,
  22. /// <summary>Moves up to the first child node of the branch that holds the current selection.</summary>
  23. LineUpToFirstBranch,
  24. /// <summary>Scrolls up one item (cell, line, etc...) (without changing the selection).</summary>
  25. ScrollUp,
  26. /// <summary>
  27. /// Moves the selection left one by the minimum increment supported by the <see cref="View"/> e.g. single
  28. /// character, cell, item etc.
  29. /// </summary>
  30. Left,
  31. /// <summary>Scrolls one item (cell, character, etc...) to the left</summary>
  32. ScrollLeft,
  33. /// <summary>
  34. /// Extends the selection left one by the minimum increment supported by the view e.g. single character, cell,
  35. /// item etc.
  36. /// </summary>
  37. LeftExtend,
  38. /// <summary>
  39. /// Moves the selection right one by the minimum increment supported by the view e.g. single character, cell, item
  40. /// etc.
  41. /// </summary>
  42. Right,
  43. /// <summary>Scrolls one item (cell, character, etc...) to the right.</summary>
  44. ScrollRight,
  45. /// <summary>
  46. /// Extends the selection right one by the minimum increment supported by the view e.g. single character, cell,
  47. /// item etc.
  48. /// </summary>
  49. RightExtend,
  50. /// <summary>Moves the caret to the start of the previous word.</summary>
  51. WordLeft,
  52. /// <summary>Extends the selection to the start of the previous word.</summary>
  53. WordLeftExtend,
  54. /// <summary>Moves the caret to the start of the next word.</summary>
  55. WordRight,
  56. /// <summary>Extends the selection to the start of the next word.</summary>
  57. WordRightExtend,
  58. /// <summary>Cuts to the clipboard the characters from the current position to the end of the line.</summary>
  59. CutToEndLine,
  60. /// <summary>Cuts to the clipboard the characters from the current position to the start of the line.</summary>
  61. CutToStartLine,
  62. /// <summary>Deletes the characters forwards.</summary>
  63. KillWordForwards,
  64. /// <summary>Deletes the characters backwards.</summary>
  65. KillWordBackwards,
  66. /// <summary>
  67. /// Toggles overwrite mode such that newly typed text overwrites the text that is already there (typically
  68. /// associated with the Insert key).
  69. /// </summary>
  70. ToggleOverwrite,
  71. /// <summary>
  72. /// Enables overwrite mode such that newly typed text overwrites the text that is already there (typically
  73. /// associated with the Insert key).
  74. /// </summary>
  75. EnableOverwrite,
  76. /// <summary>Disables overwrite mode (<see cref="EnableOverwrite"/>)</summary>
  77. DisableOverwrite,
  78. /// <summary>Move one page down.</summary>
  79. PageDown,
  80. /// <summary>Move one page page extending the selection to cover revealed objects/characters.</summary>
  81. PageDownExtend,
  82. /// <summary>Move one page up.</summary>
  83. PageUp,
  84. /// <summary>Move one page up extending the selection to cover revealed objects/characters.</summary>
  85. PageUpExtend,
  86. /// <summary>Moves to the top/home.</summary>
  87. TopHome,
  88. /// <summary>Extends the selection to the top/home.</summary>
  89. TopHomeExtend,
  90. /// <summary>Moves to the bottom/end.</summary>
  91. BottomEnd,
  92. /// <summary>Extends the selection to the bottom/end.</summary>
  93. BottomEndExtend,
  94. /// <summary>Open the selected item.</summary>
  95. OpenSelectedItem,
  96. /// <summary>Toggle the checked state.</summary>
  97. ToggleChecked,
  98. /// <summary>Accepts the current state (e.g. selection, button press etc).</summary>
  99. Accept,
  100. /// <summary>Toggles the Expanded or collapsed state of a a list or item (with subitems).</summary>
  101. ToggleExpandCollapse,
  102. /// <summary>Expands a list or item (with subitems).</summary>
  103. Expand,
  104. /// <summary>Recursively Expands all child items and their child items (if any).</summary>
  105. ExpandAll,
  106. /// <summary>Collapses a list or item (with subitems).</summary>
  107. Collapse,
  108. /// <summary>Recursively collapses a list items of their children (if any).</summary>
  109. CollapseAll,
  110. /// <summary>Cancels an action or any temporary states on the control e.g. expanding a combo list.</summary>
  111. Cancel,
  112. /// <summary>Unix emulation.</summary>
  113. UnixEmulation,
  114. /// <summary>Deletes the character on the right.</summary>
  115. DeleteCharRight,
  116. /// <summary>Deletes the character on the left.</summary>
  117. DeleteCharLeft,
  118. /// <summary>Selects all objects.</summary>
  119. SelectAll,
  120. /// <summary>Deletes all objects.</summary>
  121. DeleteAll,
  122. /// <summary>Moves the cursor to the start of line.</summary>
  123. StartOfLine,
  124. /// <summary>Extends the selection to the start of line.</summary>
  125. StartOfLineExtend,
  126. /// <summary>Moves the cursor to the end of line.</summary>
  127. EndOfLine,
  128. /// <summary>Extends the selection to the end of line.</summary>
  129. EndOfLineExtend,
  130. /// <summary>Moves the cursor to the top of page.</summary>
  131. StartOfPage,
  132. /// <summary>Moves the cursor to the bottom of page.</summary>
  133. EndOfPage,
  134. /// <summary>Moves to the left page.</summary>
  135. PageLeft,
  136. /// <summary>Moves to the right page.</summary>
  137. PageRight,
  138. /// <summary>Moves to the left begin.</summary>
  139. LeftHome,
  140. /// <summary>Extends the selection to the left begin.</summary>
  141. LeftHomeExtend,
  142. /// <summary>Moves to the right end.</summary>
  143. RightEnd,
  144. /// <summary>Extends the selection to the right end.</summary>
  145. RightEndExtend,
  146. /// <summary>Undo changes.</summary>
  147. Undo,
  148. /// <summary>Redo changes.</summary>
  149. Redo,
  150. /// <summary>Copies the current selection.</summary>
  151. Copy,
  152. /// <summary>Cuts the current selection.</summary>
  153. Cut,
  154. /// <summary>Pastes the current selection.</summary>
  155. Paste,
  156. /// <summary>Quit a <see cref="Toplevel"/>.</summary>
  157. QuitToplevel,
  158. /// <summary>Suspend a application (Only implemented in <see cref="CursesDriver"/>).</summary>
  159. Suspend,
  160. /// <summary>Moves focus to the next view.</summary>
  161. NextView,
  162. /// <summary>Moves focuss to the previous view.</summary>
  163. PreviousView,
  164. /// <summary>Moves focus to the next view or Toplevel (case of Overlapped).</summary>
  165. NextViewOrTop,
  166. /// <summary>Moves focus to the next previous or Toplevel (case of Overlapped).</summary>
  167. PreviousViewOrTop,
  168. /// <summary>Refresh.</summary>
  169. Refresh,
  170. /// <summary>Toggles the selection.</summary>
  171. ToggleExtend,
  172. /// <summary>Inserts a new item.</summary>
  173. NewLine,
  174. /// <summary>Tabs to the next item.</summary>
  175. Tab,
  176. /// <summary>Tabs back to the previous item.</summary>
  177. BackTab,
  178. /// <summary>Saves the current document.</summary>
  179. Save,
  180. /// <summary>Saves the current document with a new name.</summary>
  181. SaveAs,
  182. /// <summary>Creates a new document.</summary>
  183. New,
  184. /// <summary>Moves selection to an item (e.g. highlighting a different menu item) without necessarily accepting it.</summary>
  185. Select,
  186. /// <summary>Shows context about the item (e.g. a context menu).</summary>
  187. ShowContextMenu
  188. }