ConsoleDriver.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. //
  2. // ConsoleDriver.cs: Base class for Terminal.Gui ConsoleDriver implementations.
  3. //
  4. using System.Text;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Diagnostics;
  8. using static Terminal.Gui.ColorScheme;
  9. namespace Terminal.Gui;
  10. /// <summary>
  11. /// Base class for Terminal.Gui ConsoleDriver implementations.
  12. /// </summary>
  13. /// <remarks>
  14. /// There are currently four implementations:
  15. /// - <see cref="CursesDriver"/> (for Unix and Mac)
  16. /// - <see cref="WindowsDriver"/>
  17. /// - <see cref="NetDriver"/> that uses the .NET Console API
  18. /// - <see cref="FakeConsole"/> for unit testing.
  19. /// </remarks>
  20. public abstract class ConsoleDriver {
  21. /// <summary>
  22. /// Set this to true in any unit tests that attempt to test drivers other than FakeDriver.
  23. /// <code>
  24. /// public ColorTests ()
  25. /// {
  26. /// ConsoleDriver.RunningUnitTests = true;
  27. /// }
  28. /// </code>
  29. /// </summary>
  30. internal static bool RunningUnitTests { get; set; }
  31. #region Setup & Teardown
  32. /// <summary>
  33. /// Initializes the driver
  34. /// </summary>
  35. /// <returns>Returns an instance of <see cref="MainLoop"/> using the <see cref="IMainLoopDriver"/> for the driver.</returns>
  36. internal abstract MainLoop Init ();
  37. /// <summary>
  38. /// Ends the execution of the console driver.
  39. /// </summary>
  40. internal abstract void End ();
  41. #endregion
  42. /// <summary>
  43. /// The event fired when the terminal is resized.
  44. /// </summary>
  45. public event EventHandler<SizeChangedEventArgs> SizeChanged;
  46. /// <summary>
  47. /// Called when the terminal size changes. Fires the <see cref="SizeChanged"/> event.
  48. /// </summary>
  49. /// <param name="args"></param>
  50. public void OnSizeChanged (SizeChangedEventArgs args) => SizeChanged?.Invoke (this, args);
  51. /// <summary>
  52. /// The number of columns visible in the terminal.
  53. /// </summary>
  54. public virtual int Cols { get; internal set; }
  55. /// <summary>
  56. /// The number of rows visible in the terminal.
  57. /// </summary>
  58. public virtual int Rows { get; internal set; }
  59. /// <summary>
  60. /// The leftmost column in the terminal.
  61. /// </summary>
  62. public virtual int Left { get; internal set; } = 0;
  63. /// <summary>
  64. /// The topmost row in the terminal.
  65. /// </summary>
  66. public virtual int Top { get; internal set; } = 0;
  67. /// <summary>
  68. /// Get the operating system clipboard.
  69. /// </summary>
  70. public IClipboard Clipboard { get; internal set; }
  71. /// <summary>
  72. /// The contents of the application output. The driver outputs this buffer to the terminal when <see cref="UpdateScreen"/>
  73. /// is called.
  74. /// <remarks>
  75. /// The format of the array is rows, columns, and 3 values on the last column: Rune, Attribute and Dirty Flag
  76. /// </remarks>
  77. /// </summary>
  78. //public int [,,] Contents { get; internal set; }
  79. ///// <summary>
  80. ///// The contents of the application output. The driver outputs this buffer to the terminal when <see cref="UpdateScreen"/>
  81. ///// is called.
  82. ///// <remarks>
  83. ///// The format of the array is rows, columns. The first index is the row, the second index is the column.
  84. ///// </remarks>
  85. ///// </summary>
  86. public Cell [,] Contents { get; internal set; }
  87. /// <summary>
  88. /// Gets the column last set by <see cref="Move"/>. <see cref="Col"/> and <see cref="Row"/>
  89. /// are used by <see cref="AddRune(Rune)"/> and <see cref="AddStr"/> to determine where to add content.
  90. /// </summary>
  91. public int Col { get; internal set; }
  92. /// <summary>
  93. /// Gets the row last set by <see cref="Move"/>. <see cref="Col"/> and <see cref="Row"/>
  94. /// are used by <see cref="AddRune(Rune)"/> and <see cref="AddStr"/> to determine where to add content.
  95. /// </summary>
  96. public int Row { get; internal set; }
  97. /// <summary>
  98. /// Updates <see cref="Col"/> and <see cref="Row"/> to the specified column and row in <see cref="Contents"/>.
  99. /// Used by <see cref="AddRune(Rune)"/> and <see cref="AddStr"/> to determine where to add content.
  100. /// </summary>
  101. /// <remarks>
  102. /// <para>
  103. /// This does not move the cursor on the screen, it only updates the internal state of the driver.
  104. /// </para>
  105. /// <para>
  106. /// If <paramref name="col"/> or <paramref name="row"/> are negative or beyond <see cref="Cols"/> and <see cref="Rows"/>,
  107. /// the method still sets those properties.
  108. /// </para>
  109. /// </remarks>
  110. /// <param name="col">Column to move to.</param>
  111. /// <param name="row">Row to move to.</param>
  112. public virtual void Move (int col, int row)
  113. {
  114. Col = col;
  115. Row = row;
  116. }
  117. /// <summary>
  118. /// Tests if the specified rune is supported by the driver.
  119. /// </summary>
  120. /// <param name="rune"></param>
  121. /// <returns><see langword="true"/> if the rune can be properly presented; <see langword="false"/> if the driver
  122. /// does not support displaying this rune.</returns>
  123. public virtual bool IsRuneSupported (Rune rune)
  124. {
  125. return Rune.IsValid (rune.Value);
  126. }
  127. /// <summary>
  128. /// Adds the specified rune to the display at the current cursor position.
  129. /// </summary>
  130. /// <remarks>
  131. /// <para>
  132. /// When the method returns, <see cref="Col"/> will be incremented by the number of columns <paramref name="rune"/> required,
  133. /// even if the new column value is outside of the <see cref="Clip"/> or screen dimensions defined by <see cref="Cols"/>.
  134. /// </para>
  135. /// <para>
  136. /// If <paramref name="rune"/> requires more than one column, and <see cref="Col"/> plus the number of columns needed
  137. /// exceeds the <see cref="Clip"/> or screen dimensions, the default Unicode replacement character (U+FFFD) will be added instead.
  138. /// </para>
  139. /// </remarks>
  140. /// <param name="rune">Rune to add.</param>
  141. public void AddRune (Rune rune)
  142. {
  143. int runeWidth = -1;
  144. var validLocation = IsValidLocation (Col, Row);
  145. if (validLocation) {
  146. rune = rune.MakePrintable ();
  147. runeWidth = rune.GetColumns ();
  148. if (runeWidth == 0 && rune.IsCombiningMark () && Col > 0) {
  149. // This is a combining character, and we are not at the beginning of the line.
  150. // TODO: Remove hard-coded [0] once combining pairs is supported
  151. // Convert Runes to string and concatenate
  152. string combined = Contents [Row, Col - 1].Runes [0].ToString () + rune.ToString ();
  153. // Normalize to Form C (Canonical Composition)
  154. string normalized = combined.Normalize (NormalizationForm.FormC);
  155. Contents [Row, Col - 1].Runes = new List<Rune> { (Rune)normalized [0] }; ;
  156. Contents [Row, Col - 1].Attribute = CurrentAttribute;
  157. Contents [Row, Col - 1].IsDirty = true;
  158. //Col--;
  159. } else {
  160. Contents [Row, Col].Attribute = CurrentAttribute;
  161. Contents [Row, Col].IsDirty = true;
  162. if (Col > 0) {
  163. // Check if cell to left has a wide glyph
  164. if (Contents [Row, Col - 1].Runes [0].GetColumns () > 1) {
  165. // Invalidate cell to left
  166. Contents [Row, Col - 1].Runes = new List<Rune> { Rune.ReplacementChar };
  167. Contents [Row, Col - 1].IsDirty = true;
  168. }
  169. }
  170. if (runeWidth < 1) {
  171. Contents [Row, Col].Runes = new List<Rune> { Rune.ReplacementChar };
  172. } else if (runeWidth == 1) {
  173. Contents [Row, Col].Runes = new List<Rune> { rune };
  174. if (Col < Clip.Right - 1) {
  175. Contents [Row, Col + 1].IsDirty = true;
  176. }
  177. } else if (runeWidth == 2) {
  178. if (Col == Clip.Right - 1) {
  179. // We're at the right edge of the clip, so we can't display a wide character.
  180. // TODO: Figure out if it is better to show a replacement character or ' '
  181. Contents [Row, Col].Runes = new List<Rune> { Rune.ReplacementChar };
  182. } else {
  183. Contents [Row, Col].Runes = new List<Rune> { rune };
  184. if (Col < Clip.Right - 1) {
  185. // Invalidate cell to right so that it doesn't get drawn
  186. // TODO: Figure out if it is better to show a replacement character or ' '
  187. Contents [Row, Col + 1].Runes = new List<Rune> { Rune.ReplacementChar };
  188. Contents [Row, Col + 1].IsDirty = true;
  189. }
  190. }
  191. } else {
  192. // This is a non-spacing character, so we don't need to do anything
  193. Contents [Row, Col].Runes = new List<Rune> { (Rune)' ' };
  194. Contents [Row, Col].IsDirty = false;
  195. }
  196. _dirtyLines [Row] = true;
  197. }
  198. }
  199. if (runeWidth is < 0 or > 0) {
  200. Col++;
  201. }
  202. if (runeWidth > 1) {
  203. Debug.Assert (runeWidth <= 2);
  204. if (validLocation && Col < Clip.Right) {
  205. // This is a double-width character, and we are not at the end of the line.
  206. // Col now points to the second column of the character. Ensure it doesn't
  207. // Get rendered.
  208. Contents [Row, Col].IsDirty = false;
  209. Contents [Row, Col].Attribute = CurrentAttribute;
  210. // TODO: Determine if we should wipe this out (for now now)
  211. //Contents [Row, Col].Runes [0] = (Rune)' ';
  212. }
  213. Col++;
  214. }
  215. }
  216. /// <summary>
  217. /// Adds the specified <see langword="char"/> to the display at the current cursor position. This method
  218. /// is a convenience method that calls <see cref="AddRune(Rune)"/> with the <see cref="Rune"/> constructor.
  219. /// </summary>
  220. /// <param name="c">Character to add.</param>
  221. public void AddRune (char c) => AddRune (new Rune (c));
  222. /// <summary>
  223. /// Adds the <paramref name="str"/> to the display at the cursor position.
  224. /// </summary>
  225. /// <remarks>
  226. /// <para>
  227. /// When the method returns, <see cref="Col"/> will be incremented by the number of columns <paramref name="str"/> required,
  228. /// unless the new column value is outside of the <see cref="Clip"/> or screen dimensions defined by <see cref="Cols"/>.
  229. /// </para>
  230. /// <para>
  231. /// If <paramref name="str"/> requires more columns than are available, the output will be clipped.
  232. /// </para>
  233. /// </remarks>
  234. /// <param name="str">String.</param>
  235. public void AddStr (string str)
  236. {
  237. foreach (var rune in str.EnumerateRunes ()) {
  238. AddRune (rune);
  239. }
  240. }
  241. Rect _clip;
  242. /// <summary>
  243. /// Tests whether the specified coordinate are valid for drawing.
  244. /// </summary>
  245. /// <param name="col">The column.</param>
  246. /// <param name="row">The row.</param>
  247. /// <returns><see langword="false"/> if the coordinate is outside of the
  248. /// screen bounds or outside of <see cref="Clip"/>. <see langword="true"/> otherwise.</returns>
  249. public bool IsValidLocation (int col, int row) =>
  250. col >= 0 && row >= 0 &&
  251. col < Cols && row < Rows &&
  252. Clip.Contains (col, row);
  253. /// <summary>
  254. /// Gets or sets the clip rectangle that <see cref="AddRune(Rune)"/> and <see cref="AddStr(string)"/> are
  255. /// subject to.
  256. /// </summary>
  257. /// <value>The rectangle describing the bounds of <see cref="Clip"/>.</value>
  258. public Rect Clip {
  259. get => _clip;
  260. set => _clip = value;
  261. }
  262. /// <summary>
  263. /// Updates the screen to reflect all the changes that have been done to the display buffer
  264. /// </summary>
  265. public abstract void Refresh ();
  266. /// <summary>
  267. /// Sets the position of the terminal cursor to <see cref="Col"/> and <see cref="Row"/>.
  268. /// </summary>
  269. public abstract void UpdateCursor ();
  270. /// <summary>
  271. /// Gets the terminal cursor visibility.
  272. /// </summary>
  273. /// <param name="visibility">The current <see cref="CursorVisibility"/></param>
  274. /// <returns><see langword="true"/> upon success</returns>
  275. public abstract bool GetCursorVisibility (out CursorVisibility visibility);
  276. /// <summary>
  277. /// Sets the terminal cursor visibility.
  278. /// </summary>
  279. /// <param name="visibility">The wished <see cref="CursorVisibility"/></param>
  280. /// <returns><see langword="true"/> upon success</returns>
  281. public abstract bool SetCursorVisibility (CursorVisibility visibility);
  282. /// <summary>
  283. /// Determines if the terminal cursor should be visible or not and sets it accordingly.
  284. /// </summary>
  285. /// <returns><see langword="true"/> upon success</returns>
  286. public abstract bool EnsureCursorVisibility ();
  287. // As performance is a concern, we keep track of the dirty lines and only refresh those.
  288. // This is in addition to the dirty flag on each cell.
  289. internal bool [] _dirtyLines;
  290. /// <summary>
  291. /// Clears the <see cref="Contents"/> of the driver.
  292. /// </summary>
  293. public void ClearContents ()
  294. {
  295. // TODO: This method is really "Clear Contents" now and should not be abstract (or virtual)
  296. Contents = new Cell [Rows, Cols];
  297. Clip = new Rect (0, 0, Cols, Rows);
  298. _dirtyLines = new bool [Rows];
  299. lock (Contents) {
  300. // Can raise an exception while is still resizing.
  301. try {
  302. for (var row = 0; row < Rows; row++) {
  303. for (var c = 0; c < Cols; c++) {
  304. Contents [row, c] = new Cell () {
  305. Runes = new List<Rune> { (Rune)' ' },
  306. Attribute = new Attribute (Color.White, Color.Black),
  307. IsDirty = true
  308. };
  309. _dirtyLines [row] = true;
  310. }
  311. }
  312. } catch (IndexOutOfRangeException) { }
  313. }
  314. }
  315. /// <summary>
  316. /// Redraws the physical screen with the contents that have been queued up via any of the printing commands.
  317. /// </summary>
  318. public abstract void UpdateScreen ();
  319. #region Color Handling
  320. /// <summary>
  321. /// Gets whether the <see cref="ConsoleDriver"/> supports TrueColor output.
  322. /// </summary>
  323. public virtual bool SupportsTrueColor { get => true; }
  324. /// <summary>
  325. /// Gets or sets whether the <see cref="ConsoleDriver"/> should use 16 colors instead of the default TrueColors. See <see cref="Application.Force16Colors"/>
  326. /// to change this setting via <see cref="ConfigurationManager"/>.
  327. /// </summary>
  328. /// <remarks>
  329. /// <para>
  330. /// Will be forced to <see langword="true"/> if <see cref="ConsoleDriver.SupportsTrueColor"/> is <see langword="false"/>, indicating
  331. /// that the <see cref="ConsoleDriver"/> cannot support TrueColor.
  332. /// </para>
  333. /// </remarks>
  334. internal virtual bool Force16Colors {
  335. get => Application.Force16Colors || !SupportsTrueColor;
  336. set => Application.Force16Colors = (value || !SupportsTrueColor);
  337. }
  338. Attribute _currentAttribute;
  339. /// <summary>
  340. /// The <see cref="Attribute"/> that will be used for the next <see cref="AddRune(Rune)"/> or <see cref="AddStr"/> call.
  341. /// </summary>
  342. public Attribute CurrentAttribute {
  343. get => _currentAttribute;
  344. set {
  345. if (Application.Driver != null) {
  346. _currentAttribute = new Attribute (value.Foreground, value.Background);
  347. return;
  348. }
  349. _currentAttribute = value;
  350. }
  351. }
  352. /// <summary>
  353. /// Selects the specified attribute as the attribute to use for future calls to AddRune and AddString.
  354. /// </summary>
  355. /// <remarks>
  356. /// Implementations should call <c>base.SetAttribute(c)</c>.
  357. /// </remarks>
  358. /// <param name="c">C.</param>
  359. public Attribute SetAttribute (Attribute c)
  360. {
  361. var prevAttribute = CurrentAttribute;
  362. CurrentAttribute = c;
  363. return prevAttribute;
  364. }
  365. /// <summary>
  366. /// Gets the current <see cref="Attribute"/>.
  367. /// </summary>
  368. /// <returns>The current attribute.</returns>
  369. public Attribute GetAttribute () => CurrentAttribute;
  370. // TODO: This is only overridden by CursesDriver. Once CursesDriver supports 24-bit color, this virtual method can be
  371. // removed (and Attribute can lose the platformColor property).
  372. /// <summary>
  373. /// Makes an <see cref="Attribute"/>.
  374. /// </summary>
  375. /// <param name="foreground">The foreground color.</param>
  376. /// <param name="background">The background color.</param>
  377. /// <returns>The attribute for the foreground and background colors.</returns>
  378. public virtual Attribute MakeColor (Color foreground, Color background)
  379. {
  380. // Encode the colors into the int value.
  381. return new Attribute (
  382. platformColor: 0, // only used by cursesdriver!
  383. foreground: foreground,
  384. background: background
  385. );
  386. }
  387. #endregion
  388. #region Mouse and Keyboard
  389. /// <summary>
  390. /// Event fired after a key has been pressed and released.
  391. /// </summary>
  392. public event EventHandler<KeyEventEventArgs> KeyPressed;
  393. /// <summary>
  394. /// Called after a key has been pressed and released. Fires the <see cref="KeyPressed"/> event.
  395. /// </summary>
  396. /// <param name="a"></param>
  397. public void OnKeyPressed (KeyEventEventArgs a) => KeyPressed?.Invoke(this, a);
  398. /// <summary>
  399. /// Event fired when a key is released.
  400. /// </summary>
  401. public event EventHandler<KeyEventEventArgs> KeyUp;
  402. /// <summary>
  403. /// Called when a key is released. Fires the <see cref="KeyUp"/> event.
  404. /// </summary>
  405. /// <param name="a"></param>
  406. public void OnKeyUp (KeyEventEventArgs a) => KeyUp?.Invoke (this, a);
  407. /// <summary>
  408. /// Event fired when a key is pressed.
  409. /// </summary>
  410. public event EventHandler<KeyEventEventArgs> KeyDown;
  411. /// <summary>
  412. /// Called when a key is pressed. Fires the <see cref="KeyDown"/> event.
  413. /// </summary>
  414. /// <param name="a"></param>
  415. public void OnKeyDown (KeyEventEventArgs a) => KeyDown?.Invoke (this, a);
  416. /// <summary>
  417. /// Event fired when a mouse event occurs.
  418. /// </summary>
  419. public event EventHandler<MouseEventEventArgs> MouseEvent;
  420. /// <summary>
  421. /// Called when a mouse event occurs. Fires the <see cref="MouseEvent"/> event.
  422. /// </summary>
  423. /// <param name="a"></param>
  424. public void OnMouseEvent (MouseEventEventArgs a) => MouseEvent?.Invoke (this, a);
  425. /// <summary>
  426. /// Simulates a key press.
  427. /// </summary>
  428. /// <param name="keyChar">The key character.</param>
  429. /// <param name="key">The key.</param>
  430. /// <param name="shift">If <see langword="true"/> simulates the Shift key being pressed.</param>
  431. /// <param name="alt">If <see langword="true"/> simulates the Alt key being pressed.</param>
  432. /// <param name="ctrl">If <see langword="true"/> simulates the Ctrl key being pressed.</param>
  433. public abstract void SendKeys (char keyChar, ConsoleKey key, bool shift, bool alt, bool ctrl);
  434. #endregion
  435. /// <summary>
  436. /// Enables diagnostic functions
  437. /// </summary>
  438. [Flags]
  439. public enum DiagnosticFlags : uint {
  440. /// <summary>
  441. /// All diagnostics off
  442. /// </summary>
  443. Off = 0b_0000_0000,
  444. /// <summary>
  445. /// When enabled, <see cref="Frame.OnDrawFrames"/> will draw a
  446. /// ruler in the frame for any side with a padding value greater than 0.
  447. /// </summary>
  448. FrameRuler = 0b_0000_0001,
  449. /// <summary>
  450. /// When enabled, <see cref="Frame.OnDrawFrames"/> will draw a
  451. /// 'L', 'R', 'T', and 'B' when clearing <see cref="Thickness"/>'s instead of ' '.
  452. /// </summary>
  453. FramePadding = 0b_0000_0010,
  454. }
  455. /// <summary>
  456. /// Set flags to enable/disable <see cref="ConsoleDriver"/> diagnostics.
  457. /// </summary>
  458. public static DiagnosticFlags Diagnostics { get; set; }
  459. /// <summary>
  460. /// Suspends the application (e.g. on Linux via SIGTSTP) and upon resume, resets the console driver.
  461. /// </summary>
  462. /// <remarks>This is only implemented in <see cref="CursesDriver"/>.</remarks>
  463. public abstract void Suspend ();
  464. // TODO: Move FillRect to ./Drawing
  465. /// <summary>
  466. /// Fills the specified rectangle with the specified rune.
  467. /// </summary>
  468. /// <param name="rect"></param>
  469. /// <param name="rune"></param>
  470. public void FillRect (Rect rect, Rune rune = default)
  471. {
  472. for (var r = rect.Y; r < rect.Y + rect.Height; r++) {
  473. for (var c = rect.X; c < rect.X + rect.Width; c++) {
  474. Application.Driver.Move (c, r);
  475. Application.Driver.AddRune (rune == default ? new Rune (' ') : rune);
  476. }
  477. }
  478. }
  479. /// <summary>
  480. /// Fills the specified rectangle with the specified <see langword="char"/>. This method
  481. /// is a convenience method that calls <see cref="FillRect(Rect, Rune)"/>.
  482. /// </summary>
  483. /// <param name="rect"></param>
  484. /// <param name="c"></param>
  485. public void FillRect (Rect rect, char c) => FillRect (rect, new Rune (c));
  486. /// <summary>
  487. /// Returns the name of the driver and relevant library version information.
  488. /// </summary>
  489. /// <returns></returns>
  490. public virtual string GetVersionInfo () => GetType ().Name;
  491. }
  492. /// <summary>
  493. /// Terminal Cursor Visibility settings.
  494. /// </summary>
  495. /// <remarks>
  496. /// Hex value are set as 0xAABBCCDD where :
  497. ///
  498. /// AA stand for the TERMINFO DECSUSR parameter value to be used under Linux and MacOS
  499. /// BB stand for the NCurses curs_set parameter value to be used under Linux and MacOS
  500. /// CC stand for the CONSOLE_CURSOR_INFO.bVisible parameter value to be used under Windows
  501. /// DD stand for the CONSOLE_CURSOR_INFO.dwSize parameter value to be used under Windows
  502. ///</remarks>
  503. public enum CursorVisibility {
  504. /// <summary>
  505. /// Cursor caret has default
  506. /// </summary>
  507. /// <remarks>Works under Xterm-like terminal otherwise this is equivalent to <see ref="Underscore"/>. This default directly depends of the XTerm user configuration settings so it could be Block, I-Beam, Underline with possible blinking.</remarks>
  508. Default = 0x00010119,
  509. /// <summary>
  510. /// Cursor caret is hidden
  511. /// </summary>
  512. Invisible = 0x03000019,
  513. /// <summary>
  514. /// Cursor caret is normally shown as a blinking underline bar _
  515. /// </summary>
  516. Underline = 0x03010119,
  517. /// <summary>
  518. /// Cursor caret is normally shown as a underline bar _
  519. /// </summary>
  520. /// <remarks>Under Windows, this is equivalent to <see ref="UnderscoreBlinking"/></remarks>
  521. UnderlineFix = 0x04010119,
  522. /// <summary>
  523. /// Cursor caret is displayed a blinking vertical bar |
  524. /// </summary>
  525. /// <remarks>Works under Xterm-like terminal otherwise this is equivalent to <see ref="Underscore"/></remarks>
  526. Vertical = 0x05010119,
  527. /// <summary>
  528. /// Cursor caret is displayed a blinking vertical bar |
  529. /// </summary>
  530. /// <remarks>Works under Xterm-like terminal otherwise this is equivalent to <see ref="Underscore"/></remarks>
  531. VerticalFix = 0x06010119,
  532. /// <summary>
  533. /// Cursor caret is displayed as a blinking block ▉
  534. /// </summary>
  535. Box = 0x01020164,
  536. /// <summary>
  537. /// Cursor caret is displayed a block ▉
  538. /// </summary>
  539. /// <remarks>Works under Xterm-like terminal otherwise this is equivalent to <see ref="Block"/></remarks>
  540. BoxFix = 0x02020164,
  541. }