Command.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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>
  5. /// Actions which can be performed by the application or bound to keys in a <see cref="View"/> control.
  6. /// </summary>
  7. public enum Command {
  8. /// <summary>
  9. /// The default command. For <see cref="View"/> this focuses the view.
  10. /// </summary>
  11. Default,
  12. /// <summary>
  13. /// Moves down one item (cell, line, etc...).
  14. /// </summary>
  15. LineDown,
  16. /// <summary>
  17. /// Extends the selection down one (cell, line, etc...).
  18. /// </summary>
  19. LineDownExtend,
  20. /// <summary>
  21. /// Moves down to the last child node of the branch that holds the current selection.
  22. /// </summary>
  23. LineDownToLastBranch,
  24. /// <summary>
  25. /// Scrolls down one (cell, line, etc...) (without changing the selection).
  26. /// </summary>
  27. ScrollDown,
  28. // --------------------------------------------------------------------
  29. /// <summary>
  30. /// Moves up one (cell, line, etc...).
  31. /// </summary>
  32. LineUp,
  33. /// <summary>
  34. /// Extends the selection up one item (cell, line, etc...).
  35. /// </summary>
  36. LineUpExtend,
  37. /// <summary>
  38. /// Moves up to the first child node of the branch that holds the current selection.
  39. /// </summary>
  40. LineUpToFirstBranch,
  41. /// <summary>
  42. /// Scrolls up one item (cell, line, etc...) (without changing the selection).
  43. /// </summary>
  44. ScrollUp,
  45. /// <summary>
  46. /// Moves the selection left one by the minimum increment supported by the <see cref="View"/> e.g. single character, cell, item etc.
  47. /// </summary>
  48. Left,
  49. /// <summary>
  50. /// Scrolls one item (cell, character, etc...) to the left
  51. /// </summary>
  52. ScrollLeft,
  53. /// <summary>
  54. /// Extends the selection left one by the minimum increment supported by the view e.g. single character, cell, item etc.
  55. /// </summary>
  56. LeftExtend,
  57. /// <summary>
  58. /// Moves the selection right one by the minimum increment supported by the view e.g. single character, cell, item etc.
  59. /// </summary>
  60. Right,
  61. /// <summary>
  62. /// Scrolls one item (cell, character, etc...) to the right.
  63. /// </summary>
  64. ScrollRight,
  65. /// <summary>
  66. /// Extends the selection right one by the minimum increment supported by the view e.g. single character, cell, item etc.
  67. /// </summary>
  68. RightExtend,
  69. /// <summary>
  70. /// Moves the caret to the start of the previous word.
  71. /// </summary>
  72. WordLeft,
  73. /// <summary>
  74. /// Extends the selection to the start of the previous word.
  75. /// </summary>
  76. WordLeftExtend,
  77. /// <summary>
  78. /// Moves the caret to the start of the next word.
  79. /// </summary>
  80. WordRight,
  81. /// <summary>
  82. /// Extends the selection to the start of the next word.
  83. /// </summary>
  84. WordRightExtend,
  85. /// <summary>
  86. /// Cuts to the clipboard the characters from the current position to the end of the line.
  87. /// </summary>
  88. CutToEndLine,
  89. /// <summary>
  90. /// Cuts to the clipboard the characters from the current position to the start of the line.
  91. /// </summary>
  92. CutToStartLine,
  93. /// <summary>
  94. /// Deletes the characters forwards.
  95. /// </summary>
  96. KillWordForwards,
  97. /// <summary>
  98. /// Deletes the characters backwards.
  99. /// </summary>
  100. KillWordBackwards,
  101. /// <summary>
  102. /// Toggles overwrite mode such that newly typed text overwrites the text that is
  103. /// already there (typically associated with the Insert key).
  104. /// </summary>
  105. ToggleOverwrite,
  106. /// <summary>
  107. /// Enables overwrite mode such that newly typed text overwrites the text that is
  108. /// already there (typically associated with the Insert key).
  109. /// </summary>
  110. EnableOverwrite,
  111. /// <summary>
  112. /// Disables overwrite mode (<see cref="EnableOverwrite"/>)
  113. /// </summary>
  114. DisableOverwrite,
  115. /// <summary>
  116. /// Move one page down.
  117. /// </summary>
  118. PageDown,
  119. /// <summary>
  120. /// Move one page page extending the selection to cover revealed objects/characters.
  121. /// </summary>
  122. PageDownExtend,
  123. /// <summary>
  124. /// Move one page up.
  125. /// </summary>
  126. PageUp,
  127. /// <summary>
  128. /// Move one page up extending the selection to cover revealed objects/characters.
  129. /// </summary>
  130. PageUpExtend,
  131. /// <summary>
  132. /// Moves to the top/home.
  133. /// </summary>
  134. TopHome,
  135. /// <summary>
  136. /// Extends the selection to the top/home.
  137. /// </summary>
  138. TopHomeExtend,
  139. /// <summary>
  140. /// Moves to the bottom/end.
  141. /// </summary>
  142. BottomEnd,
  143. /// <summary>
  144. /// Extends the selection to the bottom/end.
  145. /// </summary>
  146. BottomEndExtend,
  147. /// <summary>
  148. /// Open the selected item.
  149. /// </summary>
  150. OpenSelectedItem,
  151. /// <summary>
  152. /// Toggle the checked state.
  153. /// </summary>
  154. ToggleChecked,
  155. /// <summary>
  156. /// Accepts the current state (e.g. selection, button press etc).
  157. /// </summary>
  158. Accept,
  159. /// <summary>
  160. /// Toggles the Expanded or collapsed state of a a list or item (with subitems).
  161. /// </summary>
  162. ToggleExpandCollapse,
  163. /// <summary>
  164. /// Expands a list or item (with subitems).
  165. /// </summary>
  166. Expand,
  167. /// <summary>
  168. /// Recursively Expands all child items and their child items (if any).
  169. /// </summary>
  170. ExpandAll,
  171. /// <summary>
  172. /// Collapses a list or item (with subitems).
  173. /// </summary>
  174. Collapse,
  175. /// <summary>
  176. /// Recursively collapses a list items of their children (if any).
  177. /// </summary>
  178. CollapseAll,
  179. /// <summary>
  180. /// Cancels an action or any temporary states on the control e.g. expanding
  181. /// a combo list.
  182. /// </summary>
  183. Cancel,
  184. /// <summary>
  185. /// Unix emulation.
  186. /// </summary>
  187. UnixEmulation,
  188. /// <summary>
  189. /// Deletes the character on the right.
  190. /// </summary>
  191. DeleteCharRight,
  192. /// <summary>
  193. /// Deletes the character on the left.
  194. /// </summary>
  195. DeleteCharLeft,
  196. /// <summary>
  197. /// Selects all objects.
  198. /// </summary>
  199. SelectAll,
  200. /// <summary>
  201. /// Deletes all objects.
  202. /// </summary>
  203. DeleteAll,
  204. /// <summary>
  205. /// Moves the cursor to the start of line.
  206. /// </summary>
  207. StartOfLine,
  208. /// <summary>
  209. /// Extends the selection to the start of line.
  210. /// </summary>
  211. StartOfLineExtend,
  212. /// <summary>
  213. /// Moves the cursor to the end of line.
  214. /// </summary>
  215. EndOfLine,
  216. /// <summary>
  217. /// Extends the selection to the end of line.
  218. /// </summary>
  219. EndOfLineExtend,
  220. /// <summary>
  221. /// Moves the cursor to the top of page.
  222. /// </summary>
  223. StartOfPage,
  224. /// <summary>
  225. /// Moves the cursor to the bottom of page.
  226. /// </summary>
  227. EndOfPage,
  228. /// <summary>
  229. /// Moves to the left page.
  230. /// </summary>
  231. PageLeft,
  232. /// <summary>
  233. /// Moves to the right page.
  234. /// </summary>
  235. PageRight,
  236. /// <summary>
  237. /// Moves to the left begin.
  238. /// </summary>
  239. LeftHome,
  240. /// <summary>
  241. /// Extends the selection to the left begin.
  242. /// </summary>
  243. LeftHomeExtend,
  244. /// <summary>
  245. /// Moves to the right end.
  246. /// </summary>
  247. RightEnd,
  248. /// <summary>
  249. /// Extends the selection to the right end.
  250. /// </summary>
  251. RightEndExtend,
  252. /// <summary>
  253. /// Undo changes.
  254. /// </summary>
  255. Undo,
  256. /// <summary>
  257. /// Redo changes.
  258. /// </summary>
  259. Redo,
  260. /// <summary>
  261. /// Copies the current selection.
  262. /// </summary>
  263. Copy,
  264. /// <summary>
  265. /// Cuts the current selection.
  266. /// </summary>
  267. Cut,
  268. /// <summary>
  269. /// Pastes the current selection.
  270. /// </summary>
  271. Paste,
  272. /// <summary>
  273. /// Quit a <see cref="Toplevel"/>.
  274. /// </summary>
  275. QuitToplevel,
  276. /// <summary>
  277. /// Suspend a application (Only implemented in <see cref="CursesDriver"/>).
  278. /// </summary>
  279. Suspend,
  280. /// <summary>
  281. /// Moves focus to the next view.
  282. /// </summary>
  283. NextView,
  284. /// <summary>
  285. /// Moves focuss to the previous view.
  286. /// </summary>
  287. PreviousView,
  288. /// <summary>
  289. /// Moves focus to the next view or Toplevel (case of Overlapped).
  290. /// </summary>
  291. NextViewOrTop,
  292. /// <summary>
  293. /// Moves focus to the next previous or Toplevel (case of Overlapped).
  294. /// </summary>
  295. PreviousViewOrTop,
  296. /// <summary>
  297. /// Refresh.
  298. /// </summary>
  299. Refresh,
  300. /// <summary>
  301. /// Toggles the selection.
  302. /// </summary>
  303. ToggleExtend,
  304. /// <summary>
  305. /// Inserts a new item.
  306. /// </summary>
  307. NewLine,
  308. /// <summary>
  309. /// Tabs to the next item.
  310. /// </summary>
  311. Tab,
  312. /// <summary>
  313. /// Tabs back to the previous item.
  314. /// </summary>
  315. BackTab,
  316. /// <summary>
  317. /// Saves the current document.
  318. /// </summary>
  319. Save,
  320. /// <summary>
  321. /// Saves the current document with a new name.
  322. /// </summary>
  323. SaveAs,
  324. /// <summary>
  325. /// Creates a new document.
  326. /// </summary>
  327. New,
  328. /// <summary>
  329. /// Moves selection to an item (e.g. highlighting a different menu item) without necessarily accepting it.
  330. /// </summary>
  331. Select,
  332. /// <summary>
  333. /// Shows context about the item (e.g. a context menu).
  334. /// </summary>
  335. ShowContextMenu
  336. }