Terminal.Gui.TextFormatter.html 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837
  1. <!DOCTYPE html>
  2. <!--[if IE]><![endif]-->
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <title>Class TextFormatter
  8. </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class TextFormatter
  11. ">
  12. <meta name="generator" content="docfx 2.59.3.0">
  13. <link rel="shortcut icon" href="../../favicon.ico">
  14. <link rel="stylesheet" href="../../styles/docfx.vendor.css">
  15. <link rel="stylesheet" href="../../styles/docfx.css">
  16. <link rel="stylesheet" href="../../styles/main.css">
  17. <meta property="docfx:navrel" content="../../toc.html">
  18. <meta property="docfx:tocrel" content="toc.html">
  19. <meta property="docfx:rel" content="../../">
  20. </head>
  21. <body data-spy="scroll" data-target="#affix" data-offset="120">
  22. <div id="wrapper">
  23. <header>
  24. <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
  25. <div class="container">
  26. <div class="navbar-header">
  27. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
  28. <span class="sr-only">Toggle navigation</span>
  29. <span class="icon-bar"></span>
  30. <span class="icon-bar"></span>
  31. <span class="icon-bar"></span>
  32. </button>
  33. <a class="navbar-brand" href="../../index.html">
  34. <img id="logo" class="svg" src="../../images/logo48.png" alt="">
  35. </a>
  36. </div>
  37. <div class="collapse navbar-collapse" id="navbar">
  38. <form class="navbar-form navbar-right" role="search" id="search">
  39. <div class="form-group">
  40. <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
  41. </div>
  42. </form>
  43. </div>
  44. </div>
  45. </nav>
  46. <div class="subnav navbar navbar-default">
  47. <div class="container hide-when-search" id="breadcrumb">
  48. <ul class="breadcrumb">
  49. <li></li>
  50. </ul>
  51. </div>
  52. </div>
  53. </header>
  54. <div class="container body-content">
  55. <div id="search-results">
  56. <div class="search-list">Search Results for <span></span></div>
  57. <div class="sr-items">
  58. <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
  59. </div>
  60. <ul id="pagination" data-first="First" data-prev="Previous" data-next="Next" data-last="Last"></ul>
  61. </div>
  62. </div>
  63. <div role="main" class="container body-content hide-when-search">
  64. <div class="sidenav hide-when-search">
  65. <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
  66. <div class="sidetoggle collapse" id="sidetoggle">
  67. <div id="sidetoc"></div>
  68. </div>
  69. </div>
  70. <div class="article row grid-right">
  71. <div class="col-md-10">
  72. <article class="content wrap" id="_content" data-uid="Terminal.Gui.TextFormatter">
  73. <h1 id="Terminal_Gui_TextFormatter" data-uid="Terminal.Gui.TextFormatter" class="text-break">Class TextFormatter
  74. </h1>
  75. <div class="markdown level0 summary">
  76. Provides text formatting capabilities for console apps. Supports, hotkeys, horizontal alignment, multiple lines, and word-based line wrap.
  77. </div>
  78. <div class="markdown level0 conceptual"></div>
  79. <div class="inheritance">
  80. <h5>Inheritance</h5>
  81. <div class="level0"><span class="xref">System.Object</span></div>
  82. <div class="level1"><span class="xref">TextFormatter</span></div>
  83. </div>
  84. <div class="inheritedMembers">
  85. <h5>Inherited Members</h5>
  86. <div>
  87. <span class="xref">System.Object.Equals(System.Object)</span>
  88. </div>
  89. <div>
  90. <span class="xref">System.Object.Equals(System.Object, System.Object)</span>
  91. </div>
  92. <div>
  93. <span class="xref">System.Object.GetHashCode()</span>
  94. </div>
  95. <div>
  96. <span class="xref">System.Object.GetType()</span>
  97. </div>
  98. <div>
  99. <span class="xref">System.Object.MemberwiseClone()</span>
  100. </div>
  101. <div>
  102. <span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
  103. </div>
  104. <div>
  105. <span class="xref">System.Object.ToString()</span>
  106. </div>
  107. </div>
  108. <h6><strong>Namespace</strong>: <a class="xref" href="Terminal.Gui.html">Terminal.Gui</a></h6>
  109. <h6><strong>Assembly</strong>: Terminal.Gui.dll</h6>
  110. <h5 id="Terminal_Gui_TextFormatter_syntax">Syntax</h5>
  111. <div class="codewrapper">
  112. <pre><code class="lang-csharp hljs">public class TextFormatter</code></pre>
  113. </div>
  114. <h3 id="properties">Properties
  115. </h3>
  116. <a id="Terminal_Gui_TextFormatter_Alignment_" data-uid="Terminal.Gui.TextFormatter.Alignment*"></a>
  117. <h4 id="Terminal_Gui_TextFormatter_Alignment" data-uid="Terminal.Gui.TextFormatter.Alignment">Alignment</h4>
  118. <div class="markdown level1 summary">
  119. Controls the horizontal text-alignment property.
  120. </div>
  121. <div class="markdown level1 conceptual"></div>
  122. <h5 class="decalaration">Declaration</h5>
  123. <div class="codewrapper">
  124. <pre><code class="lang-csharp hljs">public TextAlignment Alignment { get; set; }</code></pre>
  125. </div>
  126. <h5 class="propertyValue">Property Value</h5>
  127. <table class="table table-bordered table-striped table-condensed">
  128. <thead>
  129. <tr>
  130. <th>Type</th>
  131. <th>Description</th>
  132. </tr>
  133. </thead>
  134. <tbody>
  135. <tr>
  136. <td><a class="xref" href="Terminal.Gui.TextAlignment.html">TextAlignment</a></td>
  137. <td>The text alignment.</td>
  138. </tr>
  139. </tbody>
  140. </table>
  141. <a id="Terminal_Gui_TextFormatter_AutoSize_" data-uid="Terminal.Gui.TextFormatter.AutoSize*"></a>
  142. <h4 id="Terminal_Gui_TextFormatter_AutoSize" data-uid="Terminal.Gui.TextFormatter.AutoSize">AutoSize</h4>
  143. <div class="markdown level1 summary">
  144. Used by <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_Text">Text</a> to resize the view&apos;s <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Bounds">Bounds</a> with the <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_Size">Size</a>.
  145. Setting <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_AutoSize">AutoSize</a> to true only work if the <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Width">Width</a> and <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Height">Height</a> are null or
  146. <a class="xref" href="Terminal.Gui.LayoutStyle.html#Terminal_Gui_LayoutStyle_Absolute">Absolute</a> values and doesn&apos;t work with <a class="xref" href="Terminal.Gui.LayoutStyle.html#Terminal_Gui_LayoutStyle_Computed">Computed</a> layout,
  147. to avoid breaking the <a class="xref" href="Terminal.Gui.Pos.html">Pos</a> and <a class="xref" href="Terminal.Gui.Dim.html">Dim</a> settings.
  148. </div>
  149. <div class="markdown level1 conceptual"></div>
  150. <h5 class="decalaration">Declaration</h5>
  151. <div class="codewrapper">
  152. <pre><code class="lang-csharp hljs">public bool AutoSize { get; set; }</code></pre>
  153. </div>
  154. <h5 class="propertyValue">Property Value</h5>
  155. <table class="table table-bordered table-striped table-condensed">
  156. <thead>
  157. <tr>
  158. <th>Type</th>
  159. <th>Description</th>
  160. </tr>
  161. </thead>
  162. <tbody>
  163. <tr>
  164. <td><span class="xref">System.Boolean</span></td>
  165. <td></td>
  166. </tr>
  167. </tbody>
  168. </table>
  169. <a id="Terminal_Gui_TextFormatter_CursorPosition_" data-uid="Terminal.Gui.TextFormatter.CursorPosition*"></a>
  170. <h4 id="Terminal_Gui_TextFormatter_CursorPosition" data-uid="Terminal.Gui.TextFormatter.CursorPosition">CursorPosition</h4>
  171. <div class="markdown level1 summary">
  172. Gets the cursor position from <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_HotKey">HotKey</a>. If the <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_HotKey">HotKey</a> is defined, the cursor will be positioned over it.
  173. </div>
  174. <div class="markdown level1 conceptual"></div>
  175. <h5 class="decalaration">Declaration</h5>
  176. <div class="codewrapper">
  177. <pre><code class="lang-csharp hljs">public int CursorPosition { get; set; }</code></pre>
  178. </div>
  179. <h5 class="propertyValue">Property Value</h5>
  180. <table class="table table-bordered table-striped table-condensed">
  181. <thead>
  182. <tr>
  183. <th>Type</th>
  184. <th>Description</th>
  185. </tr>
  186. </thead>
  187. <tbody>
  188. <tr>
  189. <td><span class="xref">System.Int32</span></td>
  190. <td></td>
  191. </tr>
  192. </tbody>
  193. </table>
  194. <a id="Terminal_Gui_TextFormatter_Direction_" data-uid="Terminal.Gui.TextFormatter.Direction*"></a>
  195. <h4 id="Terminal_Gui_TextFormatter_Direction" data-uid="Terminal.Gui.TextFormatter.Direction">Direction</h4>
  196. <div class="markdown level1 summary">
  197. Controls the text-direction property.
  198. </div>
  199. <div class="markdown level1 conceptual"></div>
  200. <h5 class="decalaration">Declaration</h5>
  201. <div class="codewrapper">
  202. <pre><code class="lang-csharp hljs">public TextDirection Direction { get; set; }</code></pre>
  203. </div>
  204. <h5 class="propertyValue">Property Value</h5>
  205. <table class="table table-bordered table-striped table-condensed">
  206. <thead>
  207. <tr>
  208. <th>Type</th>
  209. <th>Description</th>
  210. </tr>
  211. </thead>
  212. <tbody>
  213. <tr>
  214. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  215. <td>The text vertical alignment.</td>
  216. </tr>
  217. </tbody>
  218. </table>
  219. <a id="Terminal_Gui_TextFormatter_HotKey_" data-uid="Terminal.Gui.TextFormatter.HotKey*"></a>
  220. <h4 id="Terminal_Gui_TextFormatter_HotKey" data-uid="Terminal.Gui.TextFormatter.HotKey">HotKey</h4>
  221. <div class="markdown level1 summary">
  222. Gets the hotkey. Will be an upper case letter or digit.
  223. </div>
  224. <div class="markdown level1 conceptual"></div>
  225. <h5 class="decalaration">Declaration</h5>
  226. <div class="codewrapper">
  227. <pre><code class="lang-csharp hljs">public Key HotKey { get; }</code></pre>
  228. </div>
  229. <h5 class="propertyValue">Property Value</h5>
  230. <table class="table table-bordered table-striped table-condensed">
  231. <thead>
  232. <tr>
  233. <th>Type</th>
  234. <th>Description</th>
  235. </tr>
  236. </thead>
  237. <tbody>
  238. <tr>
  239. <td><a class="xref" href="Terminal.Gui.Key.html">Key</a></td>
  240. <td></td>
  241. </tr>
  242. </tbody>
  243. </table>
  244. <a id="Terminal_Gui_TextFormatter_HotKeyPos_" data-uid="Terminal.Gui.TextFormatter.HotKeyPos*"></a>
  245. <h4 id="Terminal_Gui_TextFormatter_HotKeyPos" data-uid="Terminal.Gui.TextFormatter.HotKeyPos">HotKeyPos</h4>
  246. <div class="markdown level1 summary">
  247. The position in the text of the hotkey. The hotkey will be rendered using the hot color.
  248. </div>
  249. <div class="markdown level1 conceptual"></div>
  250. <h5 class="decalaration">Declaration</h5>
  251. <div class="codewrapper">
  252. <pre><code class="lang-csharp hljs">public int HotKeyPos { get; set; }</code></pre>
  253. </div>
  254. <h5 class="propertyValue">Property Value</h5>
  255. <table class="table table-bordered table-striped table-condensed">
  256. <thead>
  257. <tr>
  258. <th>Type</th>
  259. <th>Description</th>
  260. </tr>
  261. </thead>
  262. <tbody>
  263. <tr>
  264. <td><span class="xref">System.Int32</span></td>
  265. <td></td>
  266. </tr>
  267. </tbody>
  268. </table>
  269. <a id="Terminal_Gui_TextFormatter_HotKeySpecifier_" data-uid="Terminal.Gui.TextFormatter.HotKeySpecifier*"></a>
  270. <h4 id="Terminal_Gui_TextFormatter_HotKeySpecifier" data-uid="Terminal.Gui.TextFormatter.HotKeySpecifier">HotKeySpecifier</h4>
  271. <div class="markdown level1 summary">
  272. The specifier character for the hotkey (e.g. &apos;_&apos;). Set to &apos;\xffff&apos; to disable hotkey support for this View instance. The default is &apos;\xffff&apos;.
  273. </div>
  274. <div class="markdown level1 conceptual"></div>
  275. <h5 class="decalaration">Declaration</h5>
  276. <div class="codewrapper">
  277. <pre><code class="lang-csharp hljs">public Rune HotKeySpecifier { get; set; }</code></pre>
  278. </div>
  279. <h5 class="propertyValue">Property Value</h5>
  280. <table class="table table-bordered table-striped table-condensed">
  281. <thead>
  282. <tr>
  283. <th>Type</th>
  284. <th>Description</th>
  285. </tr>
  286. </thead>
  287. <tbody>
  288. <tr>
  289. <td><span class="xref">System.Rune</span></td>
  290. <td></td>
  291. </tr>
  292. </tbody>
  293. </table>
  294. <a id="Terminal_Gui_TextFormatter_HotKeyTagMask_" data-uid="Terminal.Gui.TextFormatter.HotKeyTagMask*"></a>
  295. <h4 id="Terminal_Gui_TextFormatter_HotKeyTagMask" data-uid="Terminal.Gui.TextFormatter.HotKeyTagMask">HotKeyTagMask</h4>
  296. <div class="markdown level1 summary">
  297. Specifies the mask to apply to the hotkey to tag it as the hotkey. The default value of <code>0x100000</code> causes
  298. the underlying Rune to be identified as a &quot;private use&quot; Unicode character.
  299. </div>
  300. <div class="markdown level1 conceptual"></div>
  301. <h5 class="decalaration">Declaration</h5>
  302. <div class="codewrapper">
  303. <pre><code class="lang-csharp hljs">public uint HotKeyTagMask { get; set; }</code></pre>
  304. </div>
  305. <h5 class="propertyValue">Property Value</h5>
  306. <table class="table table-bordered table-striped table-condensed">
  307. <thead>
  308. <tr>
  309. <th>Type</th>
  310. <th>Description</th>
  311. </tr>
  312. </thead>
  313. <tbody>
  314. <tr>
  315. <td><span class="xref">System.UInt32</span></td>
  316. <td></td>
  317. </tr>
  318. </tbody>
  319. </table>
  320. <a id="Terminal_Gui_TextFormatter_Lines_" data-uid="Terminal.Gui.TextFormatter.Lines*"></a>
  321. <h4 id="Terminal_Gui_TextFormatter_Lines" data-uid="Terminal.Gui.TextFormatter.Lines">Lines</h4>
  322. <div class="markdown level1 summary">
  323. Gets the formatted lines.
  324. </div>
  325. <div class="markdown level1 conceptual"></div>
  326. <h5 class="decalaration">Declaration</h5>
  327. <div class="codewrapper">
  328. <pre><code class="lang-csharp hljs">public List&lt;ustring&gt; Lines { get; }</code></pre>
  329. </div>
  330. <h5 class="propertyValue">Property Value</h5>
  331. <table class="table table-bordered table-striped table-condensed">
  332. <thead>
  333. <tr>
  334. <th>Type</th>
  335. <th>Description</th>
  336. </tr>
  337. </thead>
  338. <tbody>
  339. <tr>
  340. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">NStack.ustring</span>&gt;</td>
  341. <td></td>
  342. </tr>
  343. </tbody>
  344. </table>
  345. <h5 id="Terminal_Gui_TextFormatter_Lines_remarks">Remarks</h5>
  346. <div class="markdown level1 remarks">
  347. <p>
  348. Upon a &apos;get&apos; of this property, if the text needs to be formatted (if <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_NeedsFormat">NeedsFormat</a> is <code>true</code>)
  349. <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_Format_NStack_ustring_System_Int32_System_Boolean_System_Boolean_System_Boolean_System_Int32_Terminal_Gui_TextDirection_">Format(ustring, Int32, Boolean, Boolean, Boolean, Int32, TextDirection)</a> will be called internally.
  350. </p>
  351. </div>
  352. <a id="Terminal_Gui_TextFormatter_NeedsFormat_" data-uid="Terminal.Gui.TextFormatter.NeedsFormat*"></a>
  353. <h4 id="Terminal_Gui_TextFormatter_NeedsFormat" data-uid="Terminal.Gui.TextFormatter.NeedsFormat">NeedsFormat</h4>
  354. <div class="markdown level1 summary">
  355. Gets or sets whether the <a class="xref" href="Terminal.Gui.TextFormatter.html">TextFormatter</a> needs to format the text when <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_Draw_Terminal_Gui_Rect_Terminal_Gui_Attribute_Terminal_Gui_Attribute_Terminal_Gui_Rect_">Draw(Rect, Attribute, Attribute, Rect)</a> is called.
  356. If it is <code>false</code> when Draw is called, the Draw call will be faster.
  357. </div>
  358. <div class="markdown level1 conceptual"></div>
  359. <h5 class="decalaration">Declaration</h5>
  360. <div class="codewrapper">
  361. <pre><code class="lang-csharp hljs">public bool NeedsFormat { get; set; }</code></pre>
  362. </div>
  363. <h5 class="propertyValue">Property Value</h5>
  364. <table class="table table-bordered table-striped table-condensed">
  365. <thead>
  366. <tr>
  367. <th>Type</th>
  368. <th>Description</th>
  369. </tr>
  370. </thead>
  371. <tbody>
  372. <tr>
  373. <td><span class="xref">System.Boolean</span></td>
  374. <td></td>
  375. </tr>
  376. </tbody>
  377. </table>
  378. <h5 id="Terminal_Gui_TextFormatter_NeedsFormat_remarks">Remarks</h5>
  379. <div class="markdown level1 remarks">
  380. <p>
  381. This is set to true when the properties of <a class="xref" href="Terminal.Gui.TextFormatter.html">TextFormatter</a> are set.
  382. </p>
  383. </div>
  384. <a id="Terminal_Gui_TextFormatter_PreserveTrailingSpaces_" data-uid="Terminal.Gui.TextFormatter.PreserveTrailingSpaces*"></a>
  385. <h4 id="Terminal_Gui_TextFormatter_PreserveTrailingSpaces" data-uid="Terminal.Gui.TextFormatter.PreserveTrailingSpaces">PreserveTrailingSpaces</h4>
  386. <div class="markdown level1 summary">
  387. Gets or sets a flag that determines whether <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_Text">Text</a> will have trailing spaces preserved
  388. or not when <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_WordWrap_NStack_ustring_System_Int32_System_Boolean_System_Int32_Terminal_Gui_TextDirection_">WordWrap(ustring, Int32, Boolean, Int32, TextDirection)</a> is enabled. If `true` any trailing spaces will be trimmed when
  389. either the <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_Text">Text</a> property is changed or when <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_WordWrap_NStack_ustring_System_Int32_System_Boolean_System_Int32_Terminal_Gui_TextDirection_">WordWrap(ustring, Int32, Boolean, Int32, TextDirection)</a> is set to `true`.
  390. The default is `false`.
  391. </div>
  392. <div class="markdown level1 conceptual"></div>
  393. <h5 class="decalaration">Declaration</h5>
  394. <div class="codewrapper">
  395. <pre><code class="lang-csharp hljs">public bool PreserveTrailingSpaces { get; set; }</code></pre>
  396. </div>
  397. <h5 class="propertyValue">Property Value</h5>
  398. <table class="table table-bordered table-striped table-condensed">
  399. <thead>
  400. <tr>
  401. <th>Type</th>
  402. <th>Description</th>
  403. </tr>
  404. </thead>
  405. <tbody>
  406. <tr>
  407. <td><span class="xref">System.Boolean</span></td>
  408. <td></td>
  409. </tr>
  410. </tbody>
  411. </table>
  412. <a id="Terminal_Gui_TextFormatter_Size_" data-uid="Terminal.Gui.TextFormatter.Size*"></a>
  413. <h4 id="Terminal_Gui_TextFormatter_Size" data-uid="Terminal.Gui.TextFormatter.Size">Size</h4>
  414. <div class="markdown level1 summary">
  415. Gets or sets the size of the area the text will be constrained to when formatted.
  416. </div>
  417. <div class="markdown level1 conceptual"></div>
  418. <h5 class="decalaration">Declaration</h5>
  419. <div class="codewrapper">
  420. <pre><code class="lang-csharp hljs">public Size Size { get; set; }</code></pre>
  421. </div>
  422. <h5 class="propertyValue">Property Value</h5>
  423. <table class="table table-bordered table-striped table-condensed">
  424. <thead>
  425. <tr>
  426. <th>Type</th>
  427. <th>Description</th>
  428. </tr>
  429. </thead>
  430. <tbody>
  431. <tr>
  432. <td><a class="xref" href="Terminal.Gui.Size.html">Size</a></td>
  433. <td></td>
  434. </tr>
  435. </tbody>
  436. </table>
  437. <a id="Terminal_Gui_TextFormatter_Text_" data-uid="Terminal.Gui.TextFormatter.Text*"></a>
  438. <h4 id="Terminal_Gui_TextFormatter_Text" data-uid="Terminal.Gui.TextFormatter.Text">Text</h4>
  439. <div class="markdown level1 summary">
  440. The text to be displayed. This text is never modified.
  441. </div>
  442. <div class="markdown level1 conceptual"></div>
  443. <h5 class="decalaration">Declaration</h5>
  444. <div class="codewrapper">
  445. <pre><code class="lang-csharp hljs">public virtual ustring Text { get; set; }</code></pre>
  446. </div>
  447. <h5 class="propertyValue">Property Value</h5>
  448. <table class="table table-bordered table-striped table-condensed">
  449. <thead>
  450. <tr>
  451. <th>Type</th>
  452. <th>Description</th>
  453. </tr>
  454. </thead>
  455. <tbody>
  456. <tr>
  457. <td><span class="xref">NStack.ustring</span></td>
  458. <td></td>
  459. </tr>
  460. </tbody>
  461. </table>
  462. <a id="Terminal_Gui_TextFormatter_VerticalAlignment_" data-uid="Terminal.Gui.TextFormatter.VerticalAlignment*"></a>
  463. <h4 id="Terminal_Gui_TextFormatter_VerticalAlignment" data-uid="Terminal.Gui.TextFormatter.VerticalAlignment">VerticalAlignment</h4>
  464. <div class="markdown level1 summary">
  465. Controls the vertical text-alignment property.
  466. </div>
  467. <div class="markdown level1 conceptual"></div>
  468. <h5 class="decalaration">Declaration</h5>
  469. <div class="codewrapper">
  470. <pre><code class="lang-csharp hljs">public VerticalTextAlignment VerticalAlignment { get; set; }</code></pre>
  471. </div>
  472. <h5 class="propertyValue">Property Value</h5>
  473. <table class="table table-bordered table-striped table-condensed">
  474. <thead>
  475. <tr>
  476. <th>Type</th>
  477. <th>Description</th>
  478. </tr>
  479. </thead>
  480. <tbody>
  481. <tr>
  482. <td><a class="xref" href="Terminal.Gui.VerticalTextAlignment.html">VerticalTextAlignment</a></td>
  483. <td>The text vertical alignment.</td>
  484. </tr>
  485. </tbody>
  486. </table>
  487. <h3 id="methods">Methods
  488. </h3>
  489. <a id="Terminal_Gui_TextFormatter_CalcRect_" data-uid="Terminal.Gui.TextFormatter.CalcRect*"></a>
  490. <h4 id="Terminal_Gui_TextFormatter_CalcRect_System_Int32_System_Int32_NStack_ustring_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.CalcRect(System.Int32,System.Int32,NStack.ustring,Terminal.Gui.TextDirection)">CalcRect(Int32, Int32, ustring, TextDirection)</h4>
  491. <div class="markdown level1 summary">
  492. Calculates the rectangle required to hold text, assuming no word wrapping.
  493. </div>
  494. <div class="markdown level1 conceptual"></div>
  495. <h5 class="decalaration">Declaration</h5>
  496. <div class="codewrapper">
  497. <pre><code class="lang-csharp hljs">public static Rect CalcRect(int x, int y, ustring text, TextDirection direction = TextDirection.LeftRight_TopBottom)</code></pre>
  498. </div>
  499. <h5 class="parameters">Parameters</h5>
  500. <table class="table table-bordered table-striped table-condensed">
  501. <thead>
  502. <tr>
  503. <th>Type</th>
  504. <th>Name</th>
  505. <th>Description</th>
  506. </tr>
  507. </thead>
  508. <tbody>
  509. <tr>
  510. <td><span class="xref">System.Int32</span></td>
  511. <td><span class="parametername">x</span></td>
  512. <td>The x location of the rectangle</td>
  513. </tr>
  514. <tr>
  515. <td><span class="xref">System.Int32</span></td>
  516. <td><span class="parametername">y</span></td>
  517. <td>The y location of the rectangle</td>
  518. </tr>
  519. <tr>
  520. <td><span class="xref">NStack.ustring</span></td>
  521. <td><span class="parametername">text</span></td>
  522. <td>The text to measure</td>
  523. </tr>
  524. <tr>
  525. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  526. <td><span class="parametername">direction</span></td>
  527. <td>The text direction.</td>
  528. </tr>
  529. </tbody>
  530. </table>
  531. <h5 class="returns">Returns</h5>
  532. <table class="table table-bordered table-striped table-condensed">
  533. <thead>
  534. <tr>
  535. <th>Type</th>
  536. <th>Description</th>
  537. </tr>
  538. </thead>
  539. <tbody>
  540. <tr>
  541. <td><a class="xref" href="Terminal.Gui.Rect.html">Rect</a></td>
  542. <td></td>
  543. </tr>
  544. </tbody>
  545. </table>
  546. <a id="Terminal_Gui_TextFormatter_ClipAndJustify_" data-uid="Terminal.Gui.TextFormatter.ClipAndJustify*"></a>
  547. <h4 id="Terminal_Gui_TextFormatter_ClipAndJustify_NStack_ustring_System_Int32_System_Boolean_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.ClipAndJustify(NStack.ustring,System.Int32,System.Boolean,Terminal.Gui.TextDirection)">ClipAndJustify(ustring, Int32, Boolean, TextDirection)</h4>
  548. <div class="markdown level1 summary">
  549. Justifies text within a specified width.
  550. </div>
  551. <div class="markdown level1 conceptual"></div>
  552. <h5 class="decalaration">Declaration</h5>
  553. <div class="codewrapper">
  554. <pre><code class="lang-csharp hljs">public static ustring ClipAndJustify(ustring text, int width, bool justify, TextDirection textDirection = TextDirection.LeftRight_TopBottom)</code></pre>
  555. </div>
  556. <h5 class="parameters">Parameters</h5>
  557. <table class="table table-bordered table-striped table-condensed">
  558. <thead>
  559. <tr>
  560. <th>Type</th>
  561. <th>Name</th>
  562. <th>Description</th>
  563. </tr>
  564. </thead>
  565. <tbody>
  566. <tr>
  567. <td><span class="xref">NStack.ustring</span></td>
  568. <td><span class="parametername">text</span></td>
  569. <td>The text to justify.</td>
  570. </tr>
  571. <tr>
  572. <td><span class="xref">System.Int32</span></td>
  573. <td><span class="parametername">width</span></td>
  574. <td>If the text length is greater that <code>width</code> it will be clipped.</td>
  575. </tr>
  576. <tr>
  577. <td><span class="xref">System.Boolean</span></td>
  578. <td><span class="parametername">justify</span></td>
  579. <td>Justify.</td>
  580. </tr>
  581. <tr>
  582. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  583. <td><span class="parametername">textDirection</span></td>
  584. <td>The text direction.</td>
  585. </tr>
  586. </tbody>
  587. </table>
  588. <h5 class="returns">Returns</h5>
  589. <table class="table table-bordered table-striped table-condensed">
  590. <thead>
  591. <tr>
  592. <th>Type</th>
  593. <th>Description</th>
  594. </tr>
  595. </thead>
  596. <tbody>
  597. <tr>
  598. <td><span class="xref">NStack.ustring</span></td>
  599. <td>Justified and clipped text.</td>
  600. </tr>
  601. </tbody>
  602. </table>
  603. <a id="Terminal_Gui_TextFormatter_ClipAndJustify_" data-uid="Terminal.Gui.TextFormatter.ClipAndJustify*"></a>
  604. <h4 id="Terminal_Gui_TextFormatter_ClipAndJustify_NStack_ustring_System_Int32_Terminal_Gui_TextAlignment_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.ClipAndJustify(NStack.ustring,System.Int32,Terminal.Gui.TextAlignment,Terminal.Gui.TextDirection)">ClipAndJustify(ustring, Int32, TextAlignment, TextDirection)</h4>
  605. <div class="markdown level1 summary">
  606. Justifies text within a specified width.
  607. </div>
  608. <div class="markdown level1 conceptual"></div>
  609. <h5 class="decalaration">Declaration</h5>
  610. <div class="codewrapper">
  611. <pre><code class="lang-csharp hljs">public static ustring ClipAndJustify(ustring text, int width, TextAlignment talign, TextDirection textDirection = TextDirection.LeftRight_TopBottom)</code></pre>
  612. </div>
  613. <h5 class="parameters">Parameters</h5>
  614. <table class="table table-bordered table-striped table-condensed">
  615. <thead>
  616. <tr>
  617. <th>Type</th>
  618. <th>Name</th>
  619. <th>Description</th>
  620. </tr>
  621. </thead>
  622. <tbody>
  623. <tr>
  624. <td><span class="xref">NStack.ustring</span></td>
  625. <td><span class="parametername">text</span></td>
  626. <td>The text to justify.</td>
  627. </tr>
  628. <tr>
  629. <td><span class="xref">System.Int32</span></td>
  630. <td><span class="parametername">width</span></td>
  631. <td>If the text length is greater that <code>width</code> it will be clipped.</td>
  632. </tr>
  633. <tr>
  634. <td><a class="xref" href="Terminal.Gui.TextAlignment.html">TextAlignment</a></td>
  635. <td><span class="parametername">talign</span></td>
  636. <td>Alignment.</td>
  637. </tr>
  638. <tr>
  639. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  640. <td><span class="parametername">textDirection</span></td>
  641. <td>The text direction.</td>
  642. </tr>
  643. </tbody>
  644. </table>
  645. <h5 class="returns">Returns</h5>
  646. <table class="table table-bordered table-striped table-condensed">
  647. <thead>
  648. <tr>
  649. <th>Type</th>
  650. <th>Description</th>
  651. </tr>
  652. </thead>
  653. <tbody>
  654. <tr>
  655. <td><span class="xref">NStack.ustring</span></td>
  656. <td>Justified and clipped text.</td>
  657. </tr>
  658. </tbody>
  659. </table>
  660. <a id="Terminal_Gui_TextFormatter_ClipOrPad_" data-uid="Terminal.Gui.TextFormatter.ClipOrPad*"></a>
  661. <h4 id="Terminal_Gui_TextFormatter_ClipOrPad_System_String_System_Int32_" data-uid="Terminal.Gui.TextFormatter.ClipOrPad(System.String,System.Int32)">ClipOrPad(String, Int32)</h4>
  662. <div class="markdown level1 summary">
  663. Adds trailing whitespace or truncates <code data-dev-comment-type="paramref" class="paramref">text</code>
  664. so that it fits exactly <code data-dev-comment-type="paramref" class="paramref">width</code> console units.
  665. Note that some unicode characters take 2+ columns
  666. </div>
  667. <div class="markdown level1 conceptual"></div>
  668. <h5 class="decalaration">Declaration</h5>
  669. <div class="codewrapper">
  670. <pre><code class="lang-csharp hljs">public static string ClipOrPad(string text, int width)</code></pre>
  671. </div>
  672. <h5 class="parameters">Parameters</h5>
  673. <table class="table table-bordered table-striped table-condensed">
  674. <thead>
  675. <tr>
  676. <th>Type</th>
  677. <th>Name</th>
  678. <th>Description</th>
  679. </tr>
  680. </thead>
  681. <tbody>
  682. <tr>
  683. <td><span class="xref">System.String</span></td>
  684. <td><span class="parametername">text</span></td>
  685. <td></td>
  686. </tr>
  687. <tr>
  688. <td><span class="xref">System.Int32</span></td>
  689. <td><span class="parametername">width</span></td>
  690. <td></td>
  691. </tr>
  692. </tbody>
  693. </table>
  694. <h5 class="returns">Returns</h5>
  695. <table class="table table-bordered table-striped table-condensed">
  696. <thead>
  697. <tr>
  698. <th>Type</th>
  699. <th>Description</th>
  700. </tr>
  701. </thead>
  702. <tbody>
  703. <tr>
  704. <td><span class="xref">System.String</span></td>
  705. <td></td>
  706. </tr>
  707. </tbody>
  708. </table>
  709. <a id="Terminal_Gui_TextFormatter_Draw_" data-uid="Terminal.Gui.TextFormatter.Draw*"></a>
  710. <h4 id="Terminal_Gui_TextFormatter_Draw_Terminal_Gui_Rect_Terminal_Gui_Attribute_Terminal_Gui_Attribute_Terminal_Gui_Rect_" data-uid="Terminal.Gui.TextFormatter.Draw(Terminal.Gui.Rect,Terminal.Gui.Attribute,Terminal.Gui.Attribute,Terminal.Gui.Rect)">Draw(Rect, Attribute, Attribute, Rect)</h4>
  711. <div class="markdown level1 summary">
  712. Draws the text held by <a class="xref" href="Terminal.Gui.TextFormatter.html">TextFormatter</a> to <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Driver">Driver</a> using the colors specified.
  713. </div>
  714. <div class="markdown level1 conceptual"></div>
  715. <h5 class="decalaration">Declaration</h5>
  716. <div class="codewrapper">
  717. <pre><code class="lang-csharp hljs">public void Draw(Rect bounds, Attribute normalColor, Attribute hotColor, Rect containerBounds = default(Rect))</code></pre>
  718. </div>
  719. <h5 class="parameters">Parameters</h5>
  720. <table class="table table-bordered table-striped table-condensed">
  721. <thead>
  722. <tr>
  723. <th>Type</th>
  724. <th>Name</th>
  725. <th>Description</th>
  726. </tr>
  727. </thead>
  728. <tbody>
  729. <tr>
  730. <td><a class="xref" href="Terminal.Gui.Rect.html">Rect</a></td>
  731. <td><span class="parametername">bounds</span></td>
  732. <td>Specifies the screen-relative location and maximum size for drawing the text.</td>
  733. </tr>
  734. <tr>
  735. <td><a class="xref" href="Terminal.Gui.Attribute.html">Attribute</a></td>
  736. <td><span class="parametername">normalColor</span></td>
  737. <td>The color to use for all text except the hotkey</td>
  738. </tr>
  739. <tr>
  740. <td><a class="xref" href="Terminal.Gui.Attribute.html">Attribute</a></td>
  741. <td><span class="parametername">hotColor</span></td>
  742. <td>The color to use to draw the hotkey</td>
  743. </tr>
  744. <tr>
  745. <td><a class="xref" href="Terminal.Gui.Rect.html">Rect</a></td>
  746. <td><span class="parametername">containerBounds</span></td>
  747. <td>Specifies the screen-relative location and maximum container size.</td>
  748. </tr>
  749. </tbody>
  750. </table>
  751. <a id="Terminal_Gui_TextFormatter_FindHotKey_" data-uid="Terminal.Gui.TextFormatter.FindHotKey*"></a>
  752. <h4 id="Terminal_Gui_TextFormatter_FindHotKey_NStack_ustring_System_Rune_System_Boolean_System_Int32__Terminal_Gui_Key__" data-uid="Terminal.Gui.TextFormatter.FindHotKey(NStack.ustring,System.Rune,System.Boolean,System.Int32@,Terminal.Gui.Key@)">FindHotKey(ustring, Rune, Boolean, out Int32, out Key)</h4>
  753. <div class="markdown level1 summary">
  754. Finds the hotkey and its location in text.
  755. </div>
  756. <div class="markdown level1 conceptual"></div>
  757. <h5 class="decalaration">Declaration</h5>
  758. <div class="codewrapper">
  759. <pre><code class="lang-csharp hljs">public static bool FindHotKey(ustring text, Rune hotKeySpecifier, bool firstUpperCase, out int hotPos, out Key hotKey)</code></pre>
  760. </div>
  761. <h5 class="parameters">Parameters</h5>
  762. <table class="table table-bordered table-striped table-condensed">
  763. <thead>
  764. <tr>
  765. <th>Type</th>
  766. <th>Name</th>
  767. <th>Description</th>
  768. </tr>
  769. </thead>
  770. <tbody>
  771. <tr>
  772. <td><span class="xref">NStack.ustring</span></td>
  773. <td><span class="parametername">text</span></td>
  774. <td>The text to look in.</td>
  775. </tr>
  776. <tr>
  777. <td><span class="xref">System.Rune</span></td>
  778. <td><span class="parametername">hotKeySpecifier</span></td>
  779. <td>The hotkey specifier (e.g. &apos;_&apos;) to look for.</td>
  780. </tr>
  781. <tr>
  782. <td><span class="xref">System.Boolean</span></td>
  783. <td><span class="parametername">firstUpperCase</span></td>
  784. <td>If <code>true</code> the legacy behavior of identifying the first upper case character as the hotkey will be enabled.
  785. Regardless of the value of this parameter, <code>hotKeySpecifier</code> takes precedence.</td>
  786. </tr>
  787. <tr>
  788. <td><span class="xref">System.Int32</span></td>
  789. <td><span class="parametername">hotPos</span></td>
  790. <td>Outputs the Rune index into <code>text</code>.</td>
  791. </tr>
  792. <tr>
  793. <td><a class="xref" href="Terminal.Gui.Key.html">Key</a></td>
  794. <td><span class="parametername">hotKey</span></td>
  795. <td>Outputs the hotKey.</td>
  796. </tr>
  797. </tbody>
  798. </table>
  799. <h5 class="returns">Returns</h5>
  800. <table class="table table-bordered table-striped table-condensed">
  801. <thead>
  802. <tr>
  803. <th>Type</th>
  804. <th>Description</th>
  805. </tr>
  806. </thead>
  807. <tbody>
  808. <tr>
  809. <td><span class="xref">System.Boolean</span></td>
  810. <td><code>true</code> if a hotkey was found; <code>false</code> otherwise.</td>
  811. </tr>
  812. </tbody>
  813. </table>
  814. <a id="Terminal_Gui_TextFormatter_Format_" data-uid="Terminal.Gui.TextFormatter.Format*"></a>
  815. <h4 id="Terminal_Gui_TextFormatter_Format_NStack_ustring_System_Int32_System_Boolean_System_Boolean_System_Boolean_System_Int32_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.Format(NStack.ustring,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Int32,Terminal.Gui.TextDirection)">Format(ustring, Int32, Boolean, Boolean, Boolean, Int32, TextDirection)</h4>
  816. <div class="markdown level1 summary">
  817. Reformats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
  818. </div>
  819. <div class="markdown level1 conceptual"></div>
  820. <h5 class="decalaration">Declaration</h5>
  821. <div class="codewrapper">
  822. <pre><code class="lang-csharp hljs">public static List&lt;ustring&gt; Format(ustring text, int width, bool justify, bool wordWrap, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom)</code></pre>
  823. </div>
  824. <h5 class="parameters">Parameters</h5>
  825. <table class="table table-bordered table-striped table-condensed">
  826. <thead>
  827. <tr>
  828. <th>Type</th>
  829. <th>Name</th>
  830. <th>Description</th>
  831. </tr>
  832. </thead>
  833. <tbody>
  834. <tr>
  835. <td><span class="xref">NStack.ustring</span></td>
  836. <td><span class="parametername">text</span></td>
  837. <td></td>
  838. </tr>
  839. <tr>
  840. <td><span class="xref">System.Int32</span></td>
  841. <td><span class="parametername">width</span></td>
  842. <td>The width to bound the text to for word wrapping and clipping.</td>
  843. </tr>
  844. <tr>
  845. <td><span class="xref">System.Boolean</span></td>
  846. <td><span class="parametername">justify</span></td>
  847. <td>Specifies whether the text should be justified.</td>
  848. </tr>
  849. <tr>
  850. <td><span class="xref">System.Boolean</span></td>
  851. <td><span class="parametername">wordWrap</span></td>
  852. <td>If <code>true</code>, the text will be wrapped to new lines as need. If <code>false</code>, forces text to fit a single line. Line breaks are converted to spaces. The text will be clipped to <code>width</code></td>
  853. </tr>
  854. <tr>
  855. <td><span class="xref">System.Boolean</span></td>
  856. <td><span class="parametername">preserveTrailingSpaces</span></td>
  857. <td>If <code>true</code> and &apos;wordWrap&apos; also true, the wrapped text will keep the trailing spaces. If <code>false</code>, the trailing spaces will be trimmed.</td>
  858. </tr>
  859. <tr>
  860. <td><span class="xref">System.Int32</span></td>
  861. <td><span class="parametername">tabWidth</span></td>
  862. <td>The tab width.</td>
  863. </tr>
  864. <tr>
  865. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  866. <td><span class="parametername">textDirection</span></td>
  867. <td>The text direction.</td>
  868. </tr>
  869. </tbody>
  870. </table>
  871. <h5 class="returns">Returns</h5>
  872. <table class="table table-bordered table-striped table-condensed">
  873. <thead>
  874. <tr>
  875. <th>Type</th>
  876. <th>Description</th>
  877. </tr>
  878. </thead>
  879. <tbody>
  880. <tr>
  881. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">NStack.ustring</span>&gt;</td>
  882. <td>A list of word wrapped lines.</td>
  883. </tr>
  884. </tbody>
  885. </table>
  886. <h5 id="Terminal_Gui_TextFormatter_Format_NStack_ustring_System_Int32_System_Boolean_System_Boolean_System_Boolean_System_Int32_Terminal_Gui_TextDirection__remarks">Remarks</h5>
  887. <div class="markdown level1 remarks">
  888. <p>
  889. An empty <code>text</code> string will result in one empty line.
  890. </p>
  891. <p>
  892. If <code>width</code> is 0, a single, empty line will be returned.
  893. </p>
  894. <p>
  895. If <code>width</code> is int.MaxValue, the text will be formatted to the maximum width possible.
  896. </p>
  897. </div>
  898. <a id="Terminal_Gui_TextFormatter_Format_" data-uid="Terminal.Gui.TextFormatter.Format*"></a>
  899. <h4 id="Terminal_Gui_TextFormatter_Format_NStack_ustring_System_Int32_Terminal_Gui_TextAlignment_System_Boolean_System_Boolean_System_Int32_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.Format(NStack.ustring,System.Int32,Terminal.Gui.TextAlignment,System.Boolean,System.Boolean,System.Int32,Terminal.Gui.TextDirection)">Format(ustring, Int32, TextAlignment, Boolean, Boolean, Int32, TextDirection)</h4>
  900. <div class="markdown level1 summary">
  901. Reformats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
  902. </div>
  903. <div class="markdown level1 conceptual"></div>
  904. <h5 class="decalaration">Declaration</h5>
  905. <div class="codewrapper">
  906. <pre><code class="lang-csharp hljs">public static List&lt;ustring&gt; Format(ustring text, int width, TextAlignment talign, bool wordWrap, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom)</code></pre>
  907. </div>
  908. <h5 class="parameters">Parameters</h5>
  909. <table class="table table-bordered table-striped table-condensed">
  910. <thead>
  911. <tr>
  912. <th>Type</th>
  913. <th>Name</th>
  914. <th>Description</th>
  915. </tr>
  916. </thead>
  917. <tbody>
  918. <tr>
  919. <td><span class="xref">NStack.ustring</span></td>
  920. <td><span class="parametername">text</span></td>
  921. <td></td>
  922. </tr>
  923. <tr>
  924. <td><span class="xref">System.Int32</span></td>
  925. <td><span class="parametername">width</span></td>
  926. <td>The width to bound the text to for word wrapping and clipping.</td>
  927. </tr>
  928. <tr>
  929. <td><a class="xref" href="Terminal.Gui.TextAlignment.html">TextAlignment</a></td>
  930. <td><span class="parametername">talign</span></td>
  931. <td>Specifies how the text will be aligned horizontally.</td>
  932. </tr>
  933. <tr>
  934. <td><span class="xref">System.Boolean</span></td>
  935. <td><span class="parametername">wordWrap</span></td>
  936. <td>If <code>true</code>, the text will be wrapped to new lines as need. If <code>false</code>, forces text to fit a single line. Line breaks are converted to spaces. The text will be clipped to <code>width</code></td>
  937. </tr>
  938. <tr>
  939. <td><span class="xref">System.Boolean</span></td>
  940. <td><span class="parametername">preserveTrailingSpaces</span></td>
  941. <td>If <code>true</code> and &apos;wordWrap&apos; also true, the wrapped text will keep the trailing spaces. If <code>false</code>, the trailing spaces will be trimmed.</td>
  942. </tr>
  943. <tr>
  944. <td><span class="xref">System.Int32</span></td>
  945. <td><span class="parametername">tabWidth</span></td>
  946. <td>The tab width.</td>
  947. </tr>
  948. <tr>
  949. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  950. <td><span class="parametername">textDirection</span></td>
  951. <td>The text direction.</td>
  952. </tr>
  953. </tbody>
  954. </table>
  955. <h5 class="returns">Returns</h5>
  956. <table class="table table-bordered table-striped table-condensed">
  957. <thead>
  958. <tr>
  959. <th>Type</th>
  960. <th>Description</th>
  961. </tr>
  962. </thead>
  963. <tbody>
  964. <tr>
  965. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">NStack.ustring</span>&gt;</td>
  966. <td>A list of word wrapped lines.</td>
  967. </tr>
  968. </tbody>
  969. </table>
  970. <h5 id="Terminal_Gui_TextFormatter_Format_NStack_ustring_System_Int32_Terminal_Gui_TextAlignment_System_Boolean_System_Boolean_System_Int32_Terminal_Gui_TextDirection__remarks">Remarks</h5>
  971. <div class="markdown level1 remarks">
  972. <p>
  973. An empty <code>text</code> string will result in one empty line.
  974. </p>
  975. <p>
  976. If <code>width</code> is 0, a single, empty line will be returned.
  977. </p>
  978. <p>
  979. If <code>width</code> is int.MaxValue, the text will be formatted to the maximum width possible.
  980. </p>
  981. </div>
  982. <a id="Terminal_Gui_TextFormatter_GetMaxColsForWidth_" data-uid="Terminal.Gui.TextFormatter.GetMaxColsForWidth*"></a>
  983. <h4 id="Terminal_Gui_TextFormatter_GetMaxColsForWidth_System_Collections_Generic_List_NStack_ustring__System_Int32_" data-uid="Terminal.Gui.TextFormatter.GetMaxColsForWidth(System.Collections.Generic.List{NStack.ustring},System.Int32)">GetMaxColsForWidth(List&lt;ustring&gt;, Int32)</h4>
  984. <div class="markdown level1 summary">
  985. Gets the index position from the list based on the <code data-dev-comment-type="paramref" class="paramref">width</code>.
  986. </div>
  987. <div class="markdown level1 conceptual"></div>
  988. <h5 class="decalaration">Declaration</h5>
  989. <div class="codewrapper">
  990. <pre><code class="lang-csharp hljs">public static int GetMaxColsForWidth(List&lt;ustring&gt; lines, int width)</code></pre>
  991. </div>
  992. <h5 class="parameters">Parameters</h5>
  993. <table class="table table-bordered table-striped table-condensed">
  994. <thead>
  995. <tr>
  996. <th>Type</th>
  997. <th>Name</th>
  998. <th>Description</th>
  999. </tr>
  1000. </thead>
  1001. <tbody>
  1002. <tr>
  1003. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">NStack.ustring</span>&gt;</td>
  1004. <td><span class="parametername">lines</span></td>
  1005. <td>The lines.</td>
  1006. </tr>
  1007. <tr>
  1008. <td><span class="xref">System.Int32</span></td>
  1009. <td><span class="parametername">width</span></td>
  1010. <td>The width.</td>
  1011. </tr>
  1012. </tbody>
  1013. </table>
  1014. <h5 class="returns">Returns</h5>
  1015. <table class="table table-bordered table-striped table-condensed">
  1016. <thead>
  1017. <tr>
  1018. <th>Type</th>
  1019. <th>Description</th>
  1020. </tr>
  1021. </thead>
  1022. <tbody>
  1023. <tr>
  1024. <td><span class="xref">System.Int32</span></td>
  1025. <td>The index of the list that fit the width.</td>
  1026. </tr>
  1027. </tbody>
  1028. </table>
  1029. <a id="Terminal_Gui_TextFormatter_GetMaxLengthForWidth_" data-uid="Terminal.Gui.TextFormatter.GetMaxLengthForWidth*"></a>
  1030. <h4 id="Terminal_Gui_TextFormatter_GetMaxLengthForWidth_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.GetMaxLengthForWidth(NStack.ustring,System.Int32)">GetMaxLengthForWidth(ustring, Int32)</h4>
  1031. <div class="markdown level1 summary">
  1032. Gets the index position from the text based on the <code data-dev-comment-type="paramref" class="paramref">width</code>.
  1033. </div>
  1034. <div class="markdown level1 conceptual"></div>
  1035. <h5 class="decalaration">Declaration</h5>
  1036. <div class="codewrapper">
  1037. <pre><code class="lang-csharp hljs">public static int GetMaxLengthForWidth(ustring text, int width)</code></pre>
  1038. </div>
  1039. <h5 class="parameters">Parameters</h5>
  1040. <table class="table table-bordered table-striped table-condensed">
  1041. <thead>
  1042. <tr>
  1043. <th>Type</th>
  1044. <th>Name</th>
  1045. <th>Description</th>
  1046. </tr>
  1047. </thead>
  1048. <tbody>
  1049. <tr>
  1050. <td><span class="xref">NStack.ustring</span></td>
  1051. <td><span class="parametername">text</span></td>
  1052. <td>The text.</td>
  1053. </tr>
  1054. <tr>
  1055. <td><span class="xref">System.Int32</span></td>
  1056. <td><span class="parametername">width</span></td>
  1057. <td>The width.</td>
  1058. </tr>
  1059. </tbody>
  1060. </table>
  1061. <h5 class="returns">Returns</h5>
  1062. <table class="table table-bordered table-striped table-condensed">
  1063. <thead>
  1064. <tr>
  1065. <th>Type</th>
  1066. <th>Description</th>
  1067. </tr>
  1068. </thead>
  1069. <tbody>
  1070. <tr>
  1071. <td><span class="xref">System.Int32</span></td>
  1072. <td>The index of the text that fit the width.</td>
  1073. </tr>
  1074. </tbody>
  1075. </table>
  1076. <a id="Terminal_Gui_TextFormatter_GetMaxLengthForWidth_" data-uid="Terminal.Gui.TextFormatter.GetMaxLengthForWidth*"></a>
  1077. <h4 id="Terminal_Gui_TextFormatter_GetMaxLengthForWidth_System_Collections_Generic_List_System_Rune__System_Int32_" data-uid="Terminal.Gui.TextFormatter.GetMaxLengthForWidth(System.Collections.Generic.List{System.Rune},System.Int32)">GetMaxLengthForWidth(List&lt;Rune&gt;, Int32)</h4>
  1078. <div class="markdown level1 summary">
  1079. Gets the index position from the list based on the <code data-dev-comment-type="paramref" class="paramref">width</code>.
  1080. </div>
  1081. <div class="markdown level1 conceptual"></div>
  1082. <h5 class="decalaration">Declaration</h5>
  1083. <div class="codewrapper">
  1084. <pre><code class="lang-csharp hljs">public static int GetMaxLengthForWidth(List&lt;Rune&gt; runes, int width)</code></pre>
  1085. </div>
  1086. <h5 class="parameters">Parameters</h5>
  1087. <table class="table table-bordered table-striped table-condensed">
  1088. <thead>
  1089. <tr>
  1090. <th>Type</th>
  1091. <th>Name</th>
  1092. <th>Description</th>
  1093. </tr>
  1094. </thead>
  1095. <tbody>
  1096. <tr>
  1097. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">System.Rune</span>&gt;</td>
  1098. <td><span class="parametername">runes</span></td>
  1099. <td>The runes.</td>
  1100. </tr>
  1101. <tr>
  1102. <td><span class="xref">System.Int32</span></td>
  1103. <td><span class="parametername">width</span></td>
  1104. <td>The width.</td>
  1105. </tr>
  1106. </tbody>
  1107. </table>
  1108. <h5 class="returns">Returns</h5>
  1109. <table class="table table-bordered table-striped table-condensed">
  1110. <thead>
  1111. <tr>
  1112. <th>Type</th>
  1113. <th>Description</th>
  1114. </tr>
  1115. </thead>
  1116. <tbody>
  1117. <tr>
  1118. <td><span class="xref">System.Int32</span></td>
  1119. <td>The index of the list that fit the width.</td>
  1120. </tr>
  1121. </tbody>
  1122. </table>
  1123. <a id="Terminal_Gui_TextFormatter_GetSumMaxCharWidth_" data-uid="Terminal.Gui.TextFormatter.GetSumMaxCharWidth*"></a>
  1124. <h4 id="Terminal_Gui_TextFormatter_GetSumMaxCharWidth_NStack_ustring_System_Int32_System_Int32_" data-uid="Terminal.Gui.TextFormatter.GetSumMaxCharWidth(NStack.ustring,System.Int32,System.Int32)">GetSumMaxCharWidth(ustring, Int32, Int32)</h4>
  1125. <div class="markdown level1 summary">
  1126. Gets the maximum characters width from the text based on the <code data-dev-comment-type="paramref" class="paramref">startIndex</code>
  1127. and the <code data-dev-comment-type="paramref" class="paramref">length</code>.
  1128. </div>
  1129. <div class="markdown level1 conceptual"></div>
  1130. <h5 class="decalaration">Declaration</h5>
  1131. <div class="codewrapper">
  1132. <pre><code class="lang-csharp hljs">public static int GetSumMaxCharWidth(ustring text, int startIndex = -1, int length = -1)</code></pre>
  1133. </div>
  1134. <h5 class="parameters">Parameters</h5>
  1135. <table class="table table-bordered table-striped table-condensed">
  1136. <thead>
  1137. <tr>
  1138. <th>Type</th>
  1139. <th>Name</th>
  1140. <th>Description</th>
  1141. </tr>
  1142. </thead>
  1143. <tbody>
  1144. <tr>
  1145. <td><span class="xref">NStack.ustring</span></td>
  1146. <td><span class="parametername">text</span></td>
  1147. <td>The text.</td>
  1148. </tr>
  1149. <tr>
  1150. <td><span class="xref">System.Int32</span></td>
  1151. <td><span class="parametername">startIndex</span></td>
  1152. <td>The start index.</td>
  1153. </tr>
  1154. <tr>
  1155. <td><span class="xref">System.Int32</span></td>
  1156. <td><span class="parametername">length</span></td>
  1157. <td>The length.</td>
  1158. </tr>
  1159. </tbody>
  1160. </table>
  1161. <h5 class="returns">Returns</h5>
  1162. <table class="table table-bordered table-striped table-condensed">
  1163. <thead>
  1164. <tr>
  1165. <th>Type</th>
  1166. <th>Description</th>
  1167. </tr>
  1168. </thead>
  1169. <tbody>
  1170. <tr>
  1171. <td><span class="xref">System.Int32</span></td>
  1172. <td>The maximum characters width.</td>
  1173. </tr>
  1174. </tbody>
  1175. </table>
  1176. <a id="Terminal_Gui_TextFormatter_GetSumMaxCharWidth_" data-uid="Terminal.Gui.TextFormatter.GetSumMaxCharWidth*"></a>
  1177. <h4 id="Terminal_Gui_TextFormatter_GetSumMaxCharWidth_System_Collections_Generic_List_NStack_ustring__System_Int32_System_Int32_" data-uid="Terminal.Gui.TextFormatter.GetSumMaxCharWidth(System.Collections.Generic.List{NStack.ustring},System.Int32,System.Int32)">GetSumMaxCharWidth(List&lt;ustring&gt;, Int32, Int32)</h4>
  1178. <div class="markdown level1 summary">
  1179. Gets the maximum characters width from the list based on the <code data-dev-comment-type="paramref" class="paramref">startIndex</code>
  1180. and the <code data-dev-comment-type="paramref" class="paramref">length</code>.
  1181. </div>
  1182. <div class="markdown level1 conceptual"></div>
  1183. <h5 class="decalaration">Declaration</h5>
  1184. <div class="codewrapper">
  1185. <pre><code class="lang-csharp hljs">public static int GetSumMaxCharWidth(List&lt;ustring&gt; lines, int startIndex = -1, int length = -1)</code></pre>
  1186. </div>
  1187. <h5 class="parameters">Parameters</h5>
  1188. <table class="table table-bordered table-striped table-condensed">
  1189. <thead>
  1190. <tr>
  1191. <th>Type</th>
  1192. <th>Name</th>
  1193. <th>Description</th>
  1194. </tr>
  1195. </thead>
  1196. <tbody>
  1197. <tr>
  1198. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">NStack.ustring</span>&gt;</td>
  1199. <td><span class="parametername">lines</span></td>
  1200. <td>The lines.</td>
  1201. </tr>
  1202. <tr>
  1203. <td><span class="xref">System.Int32</span></td>
  1204. <td><span class="parametername">startIndex</span></td>
  1205. <td>The start index.</td>
  1206. </tr>
  1207. <tr>
  1208. <td><span class="xref">System.Int32</span></td>
  1209. <td><span class="parametername">length</span></td>
  1210. <td>The length.</td>
  1211. </tr>
  1212. </tbody>
  1213. </table>
  1214. <h5 class="returns">Returns</h5>
  1215. <table class="table table-bordered table-striped table-condensed">
  1216. <thead>
  1217. <tr>
  1218. <th>Type</th>
  1219. <th>Description</th>
  1220. </tr>
  1221. </thead>
  1222. <tbody>
  1223. <tr>
  1224. <td><span class="xref">System.Int32</span></td>
  1225. <td>The maximum characters width.</td>
  1226. </tr>
  1227. </tbody>
  1228. </table>
  1229. <a id="Terminal_Gui_TextFormatter_GetTextWidth_" data-uid="Terminal.Gui.TextFormatter.GetTextWidth*"></a>
  1230. <h4 id="Terminal_Gui_TextFormatter_GetTextWidth_NStack_ustring_" data-uid="Terminal.Gui.TextFormatter.GetTextWidth(NStack.ustring)">GetTextWidth(ustring)</h4>
  1231. <div class="markdown level1 summary">
  1232. Gets the total width of the passed text.
  1233. </div>
  1234. <div class="markdown level1 conceptual"></div>
  1235. <h5 class="decalaration">Declaration</h5>
  1236. <div class="codewrapper">
  1237. <pre><code class="lang-csharp hljs">public static int GetTextWidth(ustring text)</code></pre>
  1238. </div>
  1239. <h5 class="parameters">Parameters</h5>
  1240. <table class="table table-bordered table-striped table-condensed">
  1241. <thead>
  1242. <tr>
  1243. <th>Type</th>
  1244. <th>Name</th>
  1245. <th>Description</th>
  1246. </tr>
  1247. </thead>
  1248. <tbody>
  1249. <tr>
  1250. <td><span class="xref">NStack.ustring</span></td>
  1251. <td><span class="parametername">text</span></td>
  1252. <td></td>
  1253. </tr>
  1254. </tbody>
  1255. </table>
  1256. <h5 class="returns">Returns</h5>
  1257. <table class="table table-bordered table-striped table-condensed">
  1258. <thead>
  1259. <tr>
  1260. <th>Type</th>
  1261. <th>Description</th>
  1262. </tr>
  1263. </thead>
  1264. <tbody>
  1265. <tr>
  1266. <td><span class="xref">System.Int32</span></td>
  1267. <td>The text width.</td>
  1268. </tr>
  1269. </tbody>
  1270. </table>
  1271. <a id="Terminal_Gui_TextFormatter_IsHorizontalDirection_" data-uid="Terminal.Gui.TextFormatter.IsHorizontalDirection*"></a>
  1272. <h4 id="Terminal_Gui_TextFormatter_IsHorizontalDirection_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.IsHorizontalDirection(Terminal.Gui.TextDirection)">IsHorizontalDirection(TextDirection)</h4>
  1273. <div class="markdown level1 summary">
  1274. Check if it is a horizontal direction
  1275. </div>
  1276. <div class="markdown level1 conceptual"></div>
  1277. <h5 class="decalaration">Declaration</h5>
  1278. <div class="codewrapper">
  1279. <pre><code class="lang-csharp hljs">public static bool IsHorizontalDirection(TextDirection textDirection)</code></pre>
  1280. </div>
  1281. <h5 class="parameters">Parameters</h5>
  1282. <table class="table table-bordered table-striped table-condensed">
  1283. <thead>
  1284. <tr>
  1285. <th>Type</th>
  1286. <th>Name</th>
  1287. <th>Description</th>
  1288. </tr>
  1289. </thead>
  1290. <tbody>
  1291. <tr>
  1292. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1293. <td><span class="parametername">textDirection</span></td>
  1294. <td></td>
  1295. </tr>
  1296. </tbody>
  1297. </table>
  1298. <h5 class="returns">Returns</h5>
  1299. <table class="table table-bordered table-striped table-condensed">
  1300. <thead>
  1301. <tr>
  1302. <th>Type</th>
  1303. <th>Description</th>
  1304. </tr>
  1305. </thead>
  1306. <tbody>
  1307. <tr>
  1308. <td><span class="xref">System.Boolean</span></td>
  1309. <td></td>
  1310. </tr>
  1311. </tbody>
  1312. </table>
  1313. <a id="Terminal_Gui_TextFormatter_IsLeftToRight_" data-uid="Terminal.Gui.TextFormatter.IsLeftToRight*"></a>
  1314. <h4 id="Terminal_Gui_TextFormatter_IsLeftToRight_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.IsLeftToRight(Terminal.Gui.TextDirection)">IsLeftToRight(TextDirection)</h4>
  1315. <div class="markdown level1 summary">
  1316. Check if it is Left to Right direction
  1317. </div>
  1318. <div class="markdown level1 conceptual"></div>
  1319. <h5 class="decalaration">Declaration</h5>
  1320. <div class="codewrapper">
  1321. <pre><code class="lang-csharp hljs">public static bool IsLeftToRight(TextDirection textDirection)</code></pre>
  1322. </div>
  1323. <h5 class="parameters">Parameters</h5>
  1324. <table class="table table-bordered table-striped table-condensed">
  1325. <thead>
  1326. <tr>
  1327. <th>Type</th>
  1328. <th>Name</th>
  1329. <th>Description</th>
  1330. </tr>
  1331. </thead>
  1332. <tbody>
  1333. <tr>
  1334. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1335. <td><span class="parametername">textDirection</span></td>
  1336. <td></td>
  1337. </tr>
  1338. </tbody>
  1339. </table>
  1340. <h5 class="returns">Returns</h5>
  1341. <table class="table table-bordered table-striped table-condensed">
  1342. <thead>
  1343. <tr>
  1344. <th>Type</th>
  1345. <th>Description</th>
  1346. </tr>
  1347. </thead>
  1348. <tbody>
  1349. <tr>
  1350. <td><span class="xref">System.Boolean</span></td>
  1351. <td></td>
  1352. </tr>
  1353. </tbody>
  1354. </table>
  1355. <a id="Terminal_Gui_TextFormatter_IsTopToBottom_" data-uid="Terminal.Gui.TextFormatter.IsTopToBottom*"></a>
  1356. <h4 id="Terminal_Gui_TextFormatter_IsTopToBottom_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.IsTopToBottom(Terminal.Gui.TextDirection)">IsTopToBottom(TextDirection)</h4>
  1357. <div class="markdown level1 summary">
  1358. Check if it is Top to Bottom direction
  1359. </div>
  1360. <div class="markdown level1 conceptual"></div>
  1361. <h5 class="decalaration">Declaration</h5>
  1362. <div class="codewrapper">
  1363. <pre><code class="lang-csharp hljs">public static bool IsTopToBottom(TextDirection textDirection)</code></pre>
  1364. </div>
  1365. <h5 class="parameters">Parameters</h5>
  1366. <table class="table table-bordered table-striped table-condensed">
  1367. <thead>
  1368. <tr>
  1369. <th>Type</th>
  1370. <th>Name</th>
  1371. <th>Description</th>
  1372. </tr>
  1373. </thead>
  1374. <tbody>
  1375. <tr>
  1376. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1377. <td><span class="parametername">textDirection</span></td>
  1378. <td></td>
  1379. </tr>
  1380. </tbody>
  1381. </table>
  1382. <h5 class="returns">Returns</h5>
  1383. <table class="table table-bordered table-striped table-condensed">
  1384. <thead>
  1385. <tr>
  1386. <th>Type</th>
  1387. <th>Description</th>
  1388. </tr>
  1389. </thead>
  1390. <tbody>
  1391. <tr>
  1392. <td><span class="xref">System.Boolean</span></td>
  1393. <td></td>
  1394. </tr>
  1395. </tbody>
  1396. </table>
  1397. <a id="Terminal_Gui_TextFormatter_IsVerticalDirection_" data-uid="Terminal.Gui.TextFormatter.IsVerticalDirection*"></a>
  1398. <h4 id="Terminal_Gui_TextFormatter_IsVerticalDirection_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.IsVerticalDirection(Terminal.Gui.TextDirection)">IsVerticalDirection(TextDirection)</h4>
  1399. <div class="markdown level1 summary">
  1400. Check if it is a vertical direction
  1401. </div>
  1402. <div class="markdown level1 conceptual"></div>
  1403. <h5 class="decalaration">Declaration</h5>
  1404. <div class="codewrapper">
  1405. <pre><code class="lang-csharp hljs">public static bool IsVerticalDirection(TextDirection textDirection)</code></pre>
  1406. </div>
  1407. <h5 class="parameters">Parameters</h5>
  1408. <table class="table table-bordered table-striped table-condensed">
  1409. <thead>
  1410. <tr>
  1411. <th>Type</th>
  1412. <th>Name</th>
  1413. <th>Description</th>
  1414. </tr>
  1415. </thead>
  1416. <tbody>
  1417. <tr>
  1418. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1419. <td><span class="parametername">textDirection</span></td>
  1420. <td></td>
  1421. </tr>
  1422. </tbody>
  1423. </table>
  1424. <h5 class="returns">Returns</h5>
  1425. <table class="table table-bordered table-striped table-condensed">
  1426. <thead>
  1427. <tr>
  1428. <th>Type</th>
  1429. <th>Description</th>
  1430. </tr>
  1431. </thead>
  1432. <tbody>
  1433. <tr>
  1434. <td><span class="xref">System.Boolean</span></td>
  1435. <td></td>
  1436. </tr>
  1437. </tbody>
  1438. </table>
  1439. <a id="Terminal_Gui_TextFormatter_Justify_" data-uid="Terminal.Gui.TextFormatter.Justify*"></a>
  1440. <h4 id="Terminal_Gui_TextFormatter_Justify_NStack_ustring_System_Int32_System_Char_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.Justify(NStack.ustring,System.Int32,System.Char,Terminal.Gui.TextDirection)">Justify(ustring, Int32, Char, TextDirection)</h4>
  1441. <div class="markdown level1 summary">
  1442. Justifies the text to fill the width provided. Space will be added between words (demarked by spaces and tabs) to
  1443. make the text just fit <code>width</code>. Spaces will not be added to the ends.
  1444. </div>
  1445. <div class="markdown level1 conceptual"></div>
  1446. <h5 class="decalaration">Declaration</h5>
  1447. <div class="codewrapper">
  1448. <pre><code class="lang-csharp hljs">public static ustring Justify(ustring text, int width, char spaceChar = ' ', TextDirection textDirection = TextDirection.LeftRight_TopBottom)</code></pre>
  1449. </div>
  1450. <h5 class="parameters">Parameters</h5>
  1451. <table class="table table-bordered table-striped table-condensed">
  1452. <thead>
  1453. <tr>
  1454. <th>Type</th>
  1455. <th>Name</th>
  1456. <th>Description</th>
  1457. </tr>
  1458. </thead>
  1459. <tbody>
  1460. <tr>
  1461. <td><span class="xref">NStack.ustring</span></td>
  1462. <td><span class="parametername">text</span></td>
  1463. <td></td>
  1464. </tr>
  1465. <tr>
  1466. <td><span class="xref">System.Int32</span></td>
  1467. <td><span class="parametername">width</span></td>
  1468. <td></td>
  1469. </tr>
  1470. <tr>
  1471. <td><span class="xref">System.Char</span></td>
  1472. <td><span class="parametername">spaceChar</span></td>
  1473. <td>Character to replace whitespace and pad with. For debugging purposes.</td>
  1474. </tr>
  1475. <tr>
  1476. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1477. <td><span class="parametername">textDirection</span></td>
  1478. <td>The text direction.</td>
  1479. </tr>
  1480. </tbody>
  1481. </table>
  1482. <h5 class="returns">Returns</h5>
  1483. <table class="table table-bordered table-striped table-condensed">
  1484. <thead>
  1485. <tr>
  1486. <th>Type</th>
  1487. <th>Description</th>
  1488. </tr>
  1489. </thead>
  1490. <tbody>
  1491. <tr>
  1492. <td><span class="xref">NStack.ustring</span></td>
  1493. <td>The justified text.</td>
  1494. </tr>
  1495. </tbody>
  1496. </table>
  1497. <a id="Terminal_Gui_TextFormatter_MaxLines_" data-uid="Terminal.Gui.TextFormatter.MaxLines*"></a>
  1498. <h4 id="Terminal_Gui_TextFormatter_MaxLines_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.MaxLines(NStack.ustring,System.Int32)">MaxLines(ustring, Int32)</h4>
  1499. <div class="markdown level1 summary">
  1500. Computes the number of lines needed to render the specified text given the width.
  1501. </div>
  1502. <div class="markdown level1 conceptual"></div>
  1503. <h5 class="decalaration">Declaration</h5>
  1504. <div class="codewrapper">
  1505. <pre><code class="lang-csharp hljs">public static int MaxLines(ustring text, int width)</code></pre>
  1506. </div>
  1507. <h5 class="parameters">Parameters</h5>
  1508. <table class="table table-bordered table-striped table-condensed">
  1509. <thead>
  1510. <tr>
  1511. <th>Type</th>
  1512. <th>Name</th>
  1513. <th>Description</th>
  1514. </tr>
  1515. </thead>
  1516. <tbody>
  1517. <tr>
  1518. <td><span class="xref">NStack.ustring</span></td>
  1519. <td><span class="parametername">text</span></td>
  1520. <td>Text, may contain newlines.</td>
  1521. </tr>
  1522. <tr>
  1523. <td><span class="xref">System.Int32</span></td>
  1524. <td><span class="parametername">width</span></td>
  1525. <td>The minimum width for the text.</td>
  1526. </tr>
  1527. </tbody>
  1528. </table>
  1529. <h5 class="returns">Returns</h5>
  1530. <table class="table table-bordered table-striped table-condensed">
  1531. <thead>
  1532. <tr>
  1533. <th>Type</th>
  1534. <th>Description</th>
  1535. </tr>
  1536. </thead>
  1537. <tbody>
  1538. <tr>
  1539. <td><span class="xref">System.Int32</span></td>
  1540. <td>Number of lines.</td>
  1541. </tr>
  1542. </tbody>
  1543. </table>
  1544. <a id="Terminal_Gui_TextFormatter_MaxWidth_" data-uid="Terminal.Gui.TextFormatter.MaxWidth*"></a>
  1545. <h4 id="Terminal_Gui_TextFormatter_MaxWidth_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.MaxWidth(NStack.ustring,System.Int32)">MaxWidth(ustring, Int32)</h4>
  1546. <div class="markdown level1 summary">
  1547. Computes the maximum width needed to render the text (single line or multiple lines) given a minimum width.
  1548. </div>
  1549. <div class="markdown level1 conceptual"></div>
  1550. <h5 class="decalaration">Declaration</h5>
  1551. <div class="codewrapper">
  1552. <pre><code class="lang-csharp hljs">public static int MaxWidth(ustring text, int width)</code></pre>
  1553. </div>
  1554. <h5 class="parameters">Parameters</h5>
  1555. <table class="table table-bordered table-striped table-condensed">
  1556. <thead>
  1557. <tr>
  1558. <th>Type</th>
  1559. <th>Name</th>
  1560. <th>Description</th>
  1561. </tr>
  1562. </thead>
  1563. <tbody>
  1564. <tr>
  1565. <td><span class="xref">NStack.ustring</span></td>
  1566. <td><span class="parametername">text</span></td>
  1567. <td>Text, may contain newlines.</td>
  1568. </tr>
  1569. <tr>
  1570. <td><span class="xref">System.Int32</span></td>
  1571. <td><span class="parametername">width</span></td>
  1572. <td>The minimum width for the text.</td>
  1573. </tr>
  1574. </tbody>
  1575. </table>
  1576. <h5 class="returns">Returns</h5>
  1577. <table class="table table-bordered table-striped table-condensed">
  1578. <thead>
  1579. <tr>
  1580. <th>Type</th>
  1581. <th>Description</th>
  1582. </tr>
  1583. </thead>
  1584. <tbody>
  1585. <tr>
  1586. <td><span class="xref">System.Int32</span></td>
  1587. <td>Max width of lines.</td>
  1588. </tr>
  1589. </tbody>
  1590. </table>
  1591. <a id="Terminal_Gui_TextFormatter_RemoveHotKeySpecifier_" data-uid="Terminal.Gui.TextFormatter.RemoveHotKeySpecifier*"></a>
  1592. <h4 id="Terminal_Gui_TextFormatter_RemoveHotKeySpecifier_NStack_ustring_System_Int32_System_Rune_" data-uid="Terminal.Gui.TextFormatter.RemoveHotKeySpecifier(NStack.ustring,System.Int32,System.Rune)">RemoveHotKeySpecifier(ustring, Int32, Rune)</h4>
  1593. <div class="markdown level1 summary">
  1594. Removes the hotkey specifier from text.
  1595. </div>
  1596. <div class="markdown level1 conceptual"></div>
  1597. <h5 class="decalaration">Declaration</h5>
  1598. <div class="codewrapper">
  1599. <pre><code class="lang-csharp hljs">public static ustring RemoveHotKeySpecifier(ustring text, int hotPos, Rune hotKeySpecifier)</code></pre>
  1600. </div>
  1601. <h5 class="parameters">Parameters</h5>
  1602. <table class="table table-bordered table-striped table-condensed">
  1603. <thead>
  1604. <tr>
  1605. <th>Type</th>
  1606. <th>Name</th>
  1607. <th>Description</th>
  1608. </tr>
  1609. </thead>
  1610. <tbody>
  1611. <tr>
  1612. <td><span class="xref">NStack.ustring</span></td>
  1613. <td><span class="parametername">text</span></td>
  1614. <td>The text to manipulate.</td>
  1615. </tr>
  1616. <tr>
  1617. <td><span class="xref">System.Int32</span></td>
  1618. <td><span class="parametername">hotPos</span></td>
  1619. <td>Returns the position of the hot-key in the text. -1 if not found.</td>
  1620. </tr>
  1621. <tr>
  1622. <td><span class="xref">System.Rune</span></td>
  1623. <td><span class="parametername">hotKeySpecifier</span></td>
  1624. <td>The hot-key specifier (e.g. &apos;_&apos;) to look for.</td>
  1625. </tr>
  1626. </tbody>
  1627. </table>
  1628. <h5 class="returns">Returns</h5>
  1629. <table class="table table-bordered table-striped table-condensed">
  1630. <thead>
  1631. <tr>
  1632. <th>Type</th>
  1633. <th>Description</th>
  1634. </tr>
  1635. </thead>
  1636. <tbody>
  1637. <tr>
  1638. <td><span class="xref">NStack.ustring</span></td>
  1639. <td>The input text with the hotkey specifier (&apos;_&apos;) removed.</td>
  1640. </tr>
  1641. </tbody>
  1642. </table>
  1643. <a id="Terminal_Gui_TextFormatter_ReplaceHotKeyWithTag_" data-uid="Terminal.Gui.TextFormatter.ReplaceHotKeyWithTag*"></a>
  1644. <h4 id="Terminal_Gui_TextFormatter_ReplaceHotKeyWithTag_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.ReplaceHotKeyWithTag(NStack.ustring,System.Int32)">ReplaceHotKeyWithTag(ustring, Int32)</h4>
  1645. <div class="markdown level1 summary">
  1646. Replaces the Rune at the index specified by the <code>hotPos</code> parameter with a tag identifying
  1647. it as the hotkey.
  1648. </div>
  1649. <div class="markdown level1 conceptual"></div>
  1650. <h5 class="decalaration">Declaration</h5>
  1651. <div class="codewrapper">
  1652. <pre><code class="lang-csharp hljs">public ustring ReplaceHotKeyWithTag(ustring text, int hotPos)</code></pre>
  1653. </div>
  1654. <h5 class="parameters">Parameters</h5>
  1655. <table class="table table-bordered table-striped table-condensed">
  1656. <thead>
  1657. <tr>
  1658. <th>Type</th>
  1659. <th>Name</th>
  1660. <th>Description</th>
  1661. </tr>
  1662. </thead>
  1663. <tbody>
  1664. <tr>
  1665. <td><span class="xref">NStack.ustring</span></td>
  1666. <td><span class="parametername">text</span></td>
  1667. <td>The text to tag the hotkey in.</td>
  1668. </tr>
  1669. <tr>
  1670. <td><span class="xref">System.Int32</span></td>
  1671. <td><span class="parametername">hotPos</span></td>
  1672. <td>The Rune index of the hotkey in <code>text</code>.</td>
  1673. </tr>
  1674. </tbody>
  1675. </table>
  1676. <h5 class="returns">Returns</h5>
  1677. <table class="table table-bordered table-striped table-condensed">
  1678. <thead>
  1679. <tr>
  1680. <th>Type</th>
  1681. <th>Description</th>
  1682. </tr>
  1683. </thead>
  1684. <tbody>
  1685. <tr>
  1686. <td><span class="xref">NStack.ustring</span></td>
  1687. <td>The text with the hotkey tagged.</td>
  1688. </tr>
  1689. </tbody>
  1690. </table>
  1691. <h5 id="Terminal_Gui_TextFormatter_ReplaceHotKeyWithTag_NStack_ustring_System_Int32__remarks">Remarks</h5>
  1692. <div class="markdown level1 remarks">
  1693. The returned string will not render correctly without first un-doing the tag. To undo the tag, search for
  1694. Runes with a bitmask of <code>otKeyTagMask</code> and remove that bitmask.
  1695. </div>
  1696. <a id="Terminal_Gui_TextFormatter_WordWrap_" data-uid="Terminal.Gui.TextFormatter.WordWrap*"></a>
  1697. <h4 id="Terminal_Gui_TextFormatter_WordWrap_NStack_ustring_System_Int32_System_Boolean_System_Int32_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.WordWrap(NStack.ustring,System.Int32,System.Boolean,System.Int32,Terminal.Gui.TextDirection)">WordWrap(ustring, Int32, Boolean, Int32, TextDirection)</h4>
  1698. <div class="markdown level1 summary">
  1699. Formats the provided text to fit within the width provided using word wrapping.
  1700. </div>
  1701. <div class="markdown level1 conceptual"></div>
  1702. <h5 class="decalaration">Declaration</h5>
  1703. <div class="codewrapper">
  1704. <pre><code class="lang-csharp hljs">public static List&lt;ustring&gt; WordWrap(ustring text, int width, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom)</code></pre>
  1705. </div>
  1706. <h5 class="parameters">Parameters</h5>
  1707. <table class="table table-bordered table-striped table-condensed">
  1708. <thead>
  1709. <tr>
  1710. <th>Type</th>
  1711. <th>Name</th>
  1712. <th>Description</th>
  1713. </tr>
  1714. </thead>
  1715. <tbody>
  1716. <tr>
  1717. <td><span class="xref">NStack.ustring</span></td>
  1718. <td><span class="parametername">text</span></td>
  1719. <td>The text to word wrap</td>
  1720. </tr>
  1721. <tr>
  1722. <td><span class="xref">System.Int32</span></td>
  1723. <td><span class="parametername">width</span></td>
  1724. <td>The width to contain the text to</td>
  1725. </tr>
  1726. <tr>
  1727. <td><span class="xref">System.Boolean</span></td>
  1728. <td><span class="parametername">preserveTrailingSpaces</span></td>
  1729. <td>If <code>true</code>, the wrapped text will keep the trailing spaces.
  1730. If <code>false</code>, the trailing spaces will be trimmed.</td>
  1731. </tr>
  1732. <tr>
  1733. <td><span class="xref">System.Int32</span></td>
  1734. <td><span class="parametername">tabWidth</span></td>
  1735. <td>The tab width.</td>
  1736. </tr>
  1737. <tr>
  1738. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1739. <td><span class="parametername">textDirection</span></td>
  1740. <td>The text direction.</td>
  1741. </tr>
  1742. </tbody>
  1743. </table>
  1744. <h5 class="returns">Returns</h5>
  1745. <table class="table table-bordered table-striped table-condensed">
  1746. <thead>
  1747. <tr>
  1748. <th>Type</th>
  1749. <th>Description</th>
  1750. </tr>
  1751. </thead>
  1752. <tbody>
  1753. <tr>
  1754. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">NStack.ustring</span>&gt;</td>
  1755. <td>Returns a list of word wrapped lines.</td>
  1756. </tr>
  1757. </tbody>
  1758. </table>
  1759. <h5 id="Terminal_Gui_TextFormatter_WordWrap_NStack_ustring_System_Int32_System_Boolean_System_Int32_Terminal_Gui_TextDirection__remarks">Remarks</h5>
  1760. <div class="markdown level1 remarks">
  1761. <p>
  1762. This method does not do any justification.
  1763. </p>
  1764. <p>
  1765. This method strips Newline (&apos;\n&apos; and &apos;\r\n&apos;) sequences before processing.
  1766. </p>
  1767. </div>
  1768. <h3 id="events">Events
  1769. </h3>
  1770. <h4 id="Terminal_Gui_TextFormatter_HotKeyChanged" data-uid="Terminal.Gui.TextFormatter.HotKeyChanged">HotKeyChanged</h4>
  1771. <div class="markdown level1 summary">
  1772. Event invoked when the <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_HotKey">HotKey</a> is changed.
  1773. </div>
  1774. <div class="markdown level1 conceptual"></div>
  1775. <h5 class="decalaration">Declaration</h5>
  1776. <div class="codewrapper">
  1777. <pre><code class="lang-csharp hljs">public event Action&lt;Key&gt; HotKeyChanged</code></pre>
  1778. </div>
  1779. <h5 class="eventType">Event Type</h5>
  1780. <table class="table table-bordered table-striped table-condensed">
  1781. <thead>
  1782. <tr>
  1783. <th>Type</th>
  1784. <th>Description</th>
  1785. </tr>
  1786. </thead>
  1787. <tbody>
  1788. <tr>
  1789. <td><span class="xref">System.Action</span>&lt;<a class="xref" href="Terminal.Gui.Key.html">Key</a>&gt;</td>
  1790. <td></td>
  1791. </tr>
  1792. </tbody>
  1793. </table>
  1794. </article>
  1795. </div>
  1796. <div class="hidden-sm col-md-2" role="complementary">
  1797. <div class="sideaffix">
  1798. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  1799. <h5>In This Article</h5>
  1800. <div></div>
  1801. </nav>
  1802. </div>
  1803. </div>
  1804. </div>
  1805. </div>
  1806. <footer>
  1807. <div class="grad-bottom"></div>
  1808. <div class="footer">
  1809. <div class="container">
  1810. <span class="pull-right">
  1811. <a href="#top">Back to top</a>
  1812. </span>
  1813. <span>Generated by <strong>DocFX</strong></span>
  1814. </div>
  1815. </div>
  1816. </footer>
  1817. </div>
  1818. <script type="text/javascript" src="../../styles/docfx.vendor.js"></script>
  1819. <script type="text/javascript" src="../../styles/docfx.js"></script>
  1820. <script type="text/javascript" src="../../styles/main.js"></script>
  1821. </body>
  1822. </html>