Terminal.Gui.TextFormatter.html 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762
  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.2.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_Size_" data-uid="Terminal.Gui.TextFormatter.Size*"></a>
  385. <h4 id="Terminal_Gui_TextFormatter_Size" data-uid="Terminal.Gui.TextFormatter.Size">Size</h4>
  386. <div class="markdown level1 summary">
  387. Gets or sets the size of the area the text will be constrained to when formatted.
  388. </div>
  389. <div class="markdown level1 conceptual"></div>
  390. <h5 class="decalaration">Declaration</h5>
  391. <div class="codewrapper">
  392. <pre><code class="lang-csharp hljs">public Size Size { get; set; }</code></pre>
  393. </div>
  394. <h5 class="propertyValue">Property Value</h5>
  395. <table class="table table-bordered table-striped table-condensed">
  396. <thead>
  397. <tr>
  398. <th>Type</th>
  399. <th>Description</th>
  400. </tr>
  401. </thead>
  402. <tbody>
  403. <tr>
  404. <td><a class="xref" href="Terminal.Gui.Size.html">Size</a></td>
  405. <td></td>
  406. </tr>
  407. </tbody>
  408. </table>
  409. <a id="Terminal_Gui_TextFormatter_Text_" data-uid="Terminal.Gui.TextFormatter.Text*"></a>
  410. <h4 id="Terminal_Gui_TextFormatter_Text" data-uid="Terminal.Gui.TextFormatter.Text">Text</h4>
  411. <div class="markdown level1 summary">
  412. The text to be displayed. This text is never modified.
  413. </div>
  414. <div class="markdown level1 conceptual"></div>
  415. <h5 class="decalaration">Declaration</h5>
  416. <div class="codewrapper">
  417. <pre><code class="lang-csharp hljs">public virtual ustring Text { get; set; }</code></pre>
  418. </div>
  419. <h5 class="propertyValue">Property Value</h5>
  420. <table class="table table-bordered table-striped table-condensed">
  421. <thead>
  422. <tr>
  423. <th>Type</th>
  424. <th>Description</th>
  425. </tr>
  426. </thead>
  427. <tbody>
  428. <tr>
  429. <td><span class="xref">NStack.ustring</span></td>
  430. <td></td>
  431. </tr>
  432. </tbody>
  433. </table>
  434. <a id="Terminal_Gui_TextFormatter_VerticalAlignment_" data-uid="Terminal.Gui.TextFormatter.VerticalAlignment*"></a>
  435. <h4 id="Terminal_Gui_TextFormatter_VerticalAlignment" data-uid="Terminal.Gui.TextFormatter.VerticalAlignment">VerticalAlignment</h4>
  436. <div class="markdown level1 summary">
  437. Controls the vertical text-alignment property.
  438. </div>
  439. <div class="markdown level1 conceptual"></div>
  440. <h5 class="decalaration">Declaration</h5>
  441. <div class="codewrapper">
  442. <pre><code class="lang-csharp hljs">public VerticalTextAlignment VerticalAlignment { get; set; }</code></pre>
  443. </div>
  444. <h5 class="propertyValue">Property Value</h5>
  445. <table class="table table-bordered table-striped table-condensed">
  446. <thead>
  447. <tr>
  448. <th>Type</th>
  449. <th>Description</th>
  450. </tr>
  451. </thead>
  452. <tbody>
  453. <tr>
  454. <td><a class="xref" href="Terminal.Gui.VerticalTextAlignment.html">VerticalTextAlignment</a></td>
  455. <td>The text vertical alignment.</td>
  456. </tr>
  457. </tbody>
  458. </table>
  459. <h3 id="methods">Methods
  460. </h3>
  461. <a id="Terminal_Gui_TextFormatter_CalcRect_" data-uid="Terminal.Gui.TextFormatter.CalcRect*"></a>
  462. <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>
  463. <div class="markdown level1 summary">
  464. Calculates the rectangle required to hold text, assuming no word wrapping.
  465. </div>
  466. <div class="markdown level1 conceptual"></div>
  467. <h5 class="decalaration">Declaration</h5>
  468. <div class="codewrapper">
  469. <pre><code class="lang-csharp hljs">public static Rect CalcRect(int x, int y, ustring text, TextDirection direction = TextDirection.LeftRight_TopBottom)</code></pre>
  470. </div>
  471. <h5 class="parameters">Parameters</h5>
  472. <table class="table table-bordered table-striped table-condensed">
  473. <thead>
  474. <tr>
  475. <th>Type</th>
  476. <th>Name</th>
  477. <th>Description</th>
  478. </tr>
  479. </thead>
  480. <tbody>
  481. <tr>
  482. <td><span class="xref">System.Int32</span></td>
  483. <td><span class="parametername">x</span></td>
  484. <td>The x location of the rectangle</td>
  485. </tr>
  486. <tr>
  487. <td><span class="xref">System.Int32</span></td>
  488. <td><span class="parametername">y</span></td>
  489. <td>The y location of the rectangle</td>
  490. </tr>
  491. <tr>
  492. <td><span class="xref">NStack.ustring</span></td>
  493. <td><span class="parametername">text</span></td>
  494. <td>The text to measure</td>
  495. </tr>
  496. <tr>
  497. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  498. <td><span class="parametername">direction</span></td>
  499. <td>The text direction.</td>
  500. </tr>
  501. </tbody>
  502. </table>
  503. <h5 class="returns">Returns</h5>
  504. <table class="table table-bordered table-striped table-condensed">
  505. <thead>
  506. <tr>
  507. <th>Type</th>
  508. <th>Description</th>
  509. </tr>
  510. </thead>
  511. <tbody>
  512. <tr>
  513. <td><a class="xref" href="Terminal.Gui.Rect.html">Rect</a></td>
  514. <td></td>
  515. </tr>
  516. </tbody>
  517. </table>
  518. <a id="Terminal_Gui_TextFormatter_ClipAndJustify_" data-uid="Terminal.Gui.TextFormatter.ClipAndJustify*"></a>
  519. <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>
  520. <div class="markdown level1 summary">
  521. Justifies text within a specified width.
  522. </div>
  523. <div class="markdown level1 conceptual"></div>
  524. <h5 class="decalaration">Declaration</h5>
  525. <div class="codewrapper">
  526. <pre><code class="lang-csharp hljs">public static ustring ClipAndJustify(ustring text, int width, bool justify, TextDirection textDirection = TextDirection.LeftRight_TopBottom)</code></pre>
  527. </div>
  528. <h5 class="parameters">Parameters</h5>
  529. <table class="table table-bordered table-striped table-condensed">
  530. <thead>
  531. <tr>
  532. <th>Type</th>
  533. <th>Name</th>
  534. <th>Description</th>
  535. </tr>
  536. </thead>
  537. <tbody>
  538. <tr>
  539. <td><span class="xref">NStack.ustring</span></td>
  540. <td><span class="parametername">text</span></td>
  541. <td>The text to justify.</td>
  542. </tr>
  543. <tr>
  544. <td><span class="xref">System.Int32</span></td>
  545. <td><span class="parametername">width</span></td>
  546. <td>If the text length is greater that <code>width</code> it will be clipped.</td>
  547. </tr>
  548. <tr>
  549. <td><span class="xref">System.Boolean</span></td>
  550. <td><span class="parametername">justify</span></td>
  551. <td>Justify.</td>
  552. </tr>
  553. <tr>
  554. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  555. <td><span class="parametername">textDirection</span></td>
  556. <td>The text direction.</td>
  557. </tr>
  558. </tbody>
  559. </table>
  560. <h5 class="returns">Returns</h5>
  561. <table class="table table-bordered table-striped table-condensed">
  562. <thead>
  563. <tr>
  564. <th>Type</th>
  565. <th>Description</th>
  566. </tr>
  567. </thead>
  568. <tbody>
  569. <tr>
  570. <td><span class="xref">NStack.ustring</span></td>
  571. <td>Justified and clipped text.</td>
  572. </tr>
  573. </tbody>
  574. </table>
  575. <a id="Terminal_Gui_TextFormatter_ClipAndJustify_" data-uid="Terminal.Gui.TextFormatter.ClipAndJustify*"></a>
  576. <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>
  577. <div class="markdown level1 summary">
  578. Justifies text within a specified width.
  579. </div>
  580. <div class="markdown level1 conceptual"></div>
  581. <h5 class="decalaration">Declaration</h5>
  582. <div class="codewrapper">
  583. <pre><code class="lang-csharp hljs">public static ustring ClipAndJustify(ustring text, int width, TextAlignment talign, TextDirection textDirection = TextDirection.LeftRight_TopBottom)</code></pre>
  584. </div>
  585. <h5 class="parameters">Parameters</h5>
  586. <table class="table table-bordered table-striped table-condensed">
  587. <thead>
  588. <tr>
  589. <th>Type</th>
  590. <th>Name</th>
  591. <th>Description</th>
  592. </tr>
  593. </thead>
  594. <tbody>
  595. <tr>
  596. <td><span class="xref">NStack.ustring</span></td>
  597. <td><span class="parametername">text</span></td>
  598. <td>The text to justify.</td>
  599. </tr>
  600. <tr>
  601. <td><span class="xref">System.Int32</span></td>
  602. <td><span class="parametername">width</span></td>
  603. <td>If the text length is greater that <code>width</code> it will be clipped.</td>
  604. </tr>
  605. <tr>
  606. <td><a class="xref" href="Terminal.Gui.TextAlignment.html">TextAlignment</a></td>
  607. <td><span class="parametername">talign</span></td>
  608. <td>Alignment.</td>
  609. </tr>
  610. <tr>
  611. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  612. <td><span class="parametername">textDirection</span></td>
  613. <td>The text direction.</td>
  614. </tr>
  615. </tbody>
  616. </table>
  617. <h5 class="returns">Returns</h5>
  618. <table class="table table-bordered table-striped table-condensed">
  619. <thead>
  620. <tr>
  621. <th>Type</th>
  622. <th>Description</th>
  623. </tr>
  624. </thead>
  625. <tbody>
  626. <tr>
  627. <td><span class="xref">NStack.ustring</span></td>
  628. <td>Justified and clipped text.</td>
  629. </tr>
  630. </tbody>
  631. </table>
  632. <a id="Terminal_Gui_TextFormatter_ClipOrPad_" data-uid="Terminal.Gui.TextFormatter.ClipOrPad*"></a>
  633. <h4 id="Terminal_Gui_TextFormatter_ClipOrPad_System_String_System_Int32_" data-uid="Terminal.Gui.TextFormatter.ClipOrPad(System.String,System.Int32)">ClipOrPad(String, Int32)</h4>
  634. <div class="markdown level1 summary">
  635. Adds trailing whitespace or truncates <code data-dev-comment-type="paramref" class="paramref">text</code>
  636. so that it fits exactly <code data-dev-comment-type="paramref" class="paramref">width</code> console units.
  637. Note that some unicode characters take 2+ columns
  638. </div>
  639. <div class="markdown level1 conceptual"></div>
  640. <h5 class="decalaration">Declaration</h5>
  641. <div class="codewrapper">
  642. <pre><code class="lang-csharp hljs">public static string ClipOrPad(string text, int width)</code></pre>
  643. </div>
  644. <h5 class="parameters">Parameters</h5>
  645. <table class="table table-bordered table-striped table-condensed">
  646. <thead>
  647. <tr>
  648. <th>Type</th>
  649. <th>Name</th>
  650. <th>Description</th>
  651. </tr>
  652. </thead>
  653. <tbody>
  654. <tr>
  655. <td><span class="xref">System.String</span></td>
  656. <td><span class="parametername">text</span></td>
  657. <td></td>
  658. </tr>
  659. <tr>
  660. <td><span class="xref">System.Int32</span></td>
  661. <td><span class="parametername">width</span></td>
  662. <td></td>
  663. </tr>
  664. </tbody>
  665. </table>
  666. <h5 class="returns">Returns</h5>
  667. <table class="table table-bordered table-striped table-condensed">
  668. <thead>
  669. <tr>
  670. <th>Type</th>
  671. <th>Description</th>
  672. </tr>
  673. </thead>
  674. <tbody>
  675. <tr>
  676. <td><span class="xref">System.String</span></td>
  677. <td></td>
  678. </tr>
  679. </tbody>
  680. </table>
  681. <a id="Terminal_Gui_TextFormatter_Draw_" data-uid="Terminal.Gui.TextFormatter.Draw*"></a>
  682. <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>
  683. <div class="markdown level1 summary">
  684. 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.
  685. </div>
  686. <div class="markdown level1 conceptual"></div>
  687. <h5 class="decalaration">Declaration</h5>
  688. <div class="codewrapper">
  689. <pre><code class="lang-csharp hljs">public void Draw(Rect bounds, Attribute normalColor, Attribute hotColor, Rect containerBounds = default(Rect))</code></pre>
  690. </div>
  691. <h5 class="parameters">Parameters</h5>
  692. <table class="table table-bordered table-striped table-condensed">
  693. <thead>
  694. <tr>
  695. <th>Type</th>
  696. <th>Name</th>
  697. <th>Description</th>
  698. </tr>
  699. </thead>
  700. <tbody>
  701. <tr>
  702. <td><a class="xref" href="Terminal.Gui.Rect.html">Rect</a></td>
  703. <td><span class="parametername">bounds</span></td>
  704. <td>Specifies the screen-relative location and maximum size for drawing the text.</td>
  705. </tr>
  706. <tr>
  707. <td><a class="xref" href="Terminal.Gui.Attribute.html">Attribute</a></td>
  708. <td><span class="parametername">normalColor</span></td>
  709. <td>The color to use for all text except the hotkey</td>
  710. </tr>
  711. <tr>
  712. <td><a class="xref" href="Terminal.Gui.Attribute.html">Attribute</a></td>
  713. <td><span class="parametername">hotColor</span></td>
  714. <td>The color to use to draw the hotkey</td>
  715. </tr>
  716. <tr>
  717. <td><a class="xref" href="Terminal.Gui.Rect.html">Rect</a></td>
  718. <td><span class="parametername">containerBounds</span></td>
  719. <td>Specifies the screen-relative location and maximum container size.</td>
  720. </tr>
  721. </tbody>
  722. </table>
  723. <a id="Terminal_Gui_TextFormatter_FindHotKey_" data-uid="Terminal.Gui.TextFormatter.FindHotKey*"></a>
  724. <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>
  725. <div class="markdown level1 summary">
  726. Finds the hotkey and its location in text.
  727. </div>
  728. <div class="markdown level1 conceptual"></div>
  729. <h5 class="decalaration">Declaration</h5>
  730. <div class="codewrapper">
  731. <pre><code class="lang-csharp hljs">public static bool FindHotKey(ustring text, Rune hotKeySpecifier, bool firstUpperCase, out int hotPos, out Key hotKey)</code></pre>
  732. </div>
  733. <h5 class="parameters">Parameters</h5>
  734. <table class="table table-bordered table-striped table-condensed">
  735. <thead>
  736. <tr>
  737. <th>Type</th>
  738. <th>Name</th>
  739. <th>Description</th>
  740. </tr>
  741. </thead>
  742. <tbody>
  743. <tr>
  744. <td><span class="xref">NStack.ustring</span></td>
  745. <td><span class="parametername">text</span></td>
  746. <td>The text to look in.</td>
  747. </tr>
  748. <tr>
  749. <td><span class="xref">System.Rune</span></td>
  750. <td><span class="parametername">hotKeySpecifier</span></td>
  751. <td>The hotkey specifier (e.g. &apos;_&apos;) to look for.</td>
  752. </tr>
  753. <tr>
  754. <td><span class="xref">System.Boolean</span></td>
  755. <td><span class="parametername">firstUpperCase</span></td>
  756. <td>If <code>true</code> the legacy behavior of identifying the first upper case character as the hotkey will be enabled.
  757. Regardless of the value of this parameter, <code>hotKeySpecifier</code> takes precedence.</td>
  758. </tr>
  759. <tr>
  760. <td><span class="xref">System.Int32</span></td>
  761. <td><span class="parametername">hotPos</span></td>
  762. <td>Outputs the Rune index into <code>text</code>.</td>
  763. </tr>
  764. <tr>
  765. <td><a class="xref" href="Terminal.Gui.Key.html">Key</a></td>
  766. <td><span class="parametername">hotKey</span></td>
  767. <td>Outputs the hotKey.</td>
  768. </tr>
  769. </tbody>
  770. </table>
  771. <h5 class="returns">Returns</h5>
  772. <table class="table table-bordered table-striped table-condensed">
  773. <thead>
  774. <tr>
  775. <th>Type</th>
  776. <th>Description</th>
  777. </tr>
  778. </thead>
  779. <tbody>
  780. <tr>
  781. <td><span class="xref">System.Boolean</span></td>
  782. <td><code>true</code> if a hotkey was found; <code>false</code> otherwise.</td>
  783. </tr>
  784. </tbody>
  785. </table>
  786. <a id="Terminal_Gui_TextFormatter_Format_" data-uid="Terminal.Gui.TextFormatter.Format*"></a>
  787. <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>
  788. <div class="markdown level1 summary">
  789. Reformats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
  790. </div>
  791. <div class="markdown level1 conceptual"></div>
  792. <h5 class="decalaration">Declaration</h5>
  793. <div class="codewrapper">
  794. <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>
  795. </div>
  796. <h5 class="parameters">Parameters</h5>
  797. <table class="table table-bordered table-striped table-condensed">
  798. <thead>
  799. <tr>
  800. <th>Type</th>
  801. <th>Name</th>
  802. <th>Description</th>
  803. </tr>
  804. </thead>
  805. <tbody>
  806. <tr>
  807. <td><span class="xref">NStack.ustring</span></td>
  808. <td><span class="parametername">text</span></td>
  809. <td></td>
  810. </tr>
  811. <tr>
  812. <td><span class="xref">System.Int32</span></td>
  813. <td><span class="parametername">width</span></td>
  814. <td>The width to bound the text to for word wrapping and clipping.</td>
  815. </tr>
  816. <tr>
  817. <td><span class="xref">System.Boolean</span></td>
  818. <td><span class="parametername">justify</span></td>
  819. <td>Specifies whether the text should be justified.</td>
  820. </tr>
  821. <tr>
  822. <td><span class="xref">System.Boolean</span></td>
  823. <td><span class="parametername">wordWrap</span></td>
  824. <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>
  825. </tr>
  826. <tr>
  827. <td><span class="xref">System.Boolean</span></td>
  828. <td><span class="parametername">preserveTrailingSpaces</span></td>
  829. <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>
  830. </tr>
  831. <tr>
  832. <td><span class="xref">System.Int32</span></td>
  833. <td><span class="parametername">tabWidth</span></td>
  834. <td>The tab width.</td>
  835. </tr>
  836. <tr>
  837. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  838. <td><span class="parametername">textDirection</span></td>
  839. <td>The text direction.</td>
  840. </tr>
  841. </tbody>
  842. </table>
  843. <h5 class="returns">Returns</h5>
  844. <table class="table table-bordered table-striped table-condensed">
  845. <thead>
  846. <tr>
  847. <th>Type</th>
  848. <th>Description</th>
  849. </tr>
  850. </thead>
  851. <tbody>
  852. <tr>
  853. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">NStack.ustring</span>&gt;</td>
  854. <td>A list of word wrapped lines.</td>
  855. </tr>
  856. </tbody>
  857. </table>
  858. <h5 id="Terminal_Gui_TextFormatter_Format_NStack_ustring_System_Int32_System_Boolean_System_Boolean_System_Boolean_System_Int32_Terminal_Gui_TextDirection__remarks">Remarks</h5>
  859. <div class="markdown level1 remarks">
  860. <p>
  861. An empty <code>text</code> string will result in one empty line.
  862. </p>
  863. <p>
  864. If <code>width</code> is 0, a single, empty line will be returned.
  865. </p>
  866. <p>
  867. If <code>width</code> is int.MaxValue, the text will be formatted to the maximum width possible.
  868. </p>
  869. </div>
  870. <a id="Terminal_Gui_TextFormatter_Format_" data-uid="Terminal.Gui.TextFormatter.Format*"></a>
  871. <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>
  872. <div class="markdown level1 summary">
  873. Reformats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
  874. </div>
  875. <div class="markdown level1 conceptual"></div>
  876. <h5 class="decalaration">Declaration</h5>
  877. <div class="codewrapper">
  878. <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>
  879. </div>
  880. <h5 class="parameters">Parameters</h5>
  881. <table class="table table-bordered table-striped table-condensed">
  882. <thead>
  883. <tr>
  884. <th>Type</th>
  885. <th>Name</th>
  886. <th>Description</th>
  887. </tr>
  888. </thead>
  889. <tbody>
  890. <tr>
  891. <td><span class="xref">NStack.ustring</span></td>
  892. <td><span class="parametername">text</span></td>
  893. <td></td>
  894. </tr>
  895. <tr>
  896. <td><span class="xref">System.Int32</span></td>
  897. <td><span class="parametername">width</span></td>
  898. <td>The width to bound the text to for word wrapping and clipping.</td>
  899. </tr>
  900. <tr>
  901. <td><a class="xref" href="Terminal.Gui.TextAlignment.html">TextAlignment</a></td>
  902. <td><span class="parametername">talign</span></td>
  903. <td>Specifies how the text will be aligned horizontally.</td>
  904. </tr>
  905. <tr>
  906. <td><span class="xref">System.Boolean</span></td>
  907. <td><span class="parametername">wordWrap</span></td>
  908. <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>
  909. </tr>
  910. <tr>
  911. <td><span class="xref">System.Boolean</span></td>
  912. <td><span class="parametername">preserveTrailingSpaces</span></td>
  913. <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>
  914. </tr>
  915. <tr>
  916. <td><span class="xref">System.Int32</span></td>
  917. <td><span class="parametername">tabWidth</span></td>
  918. <td>The tab width.</td>
  919. </tr>
  920. <tr>
  921. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  922. <td><span class="parametername">textDirection</span></td>
  923. <td>The text direction.</td>
  924. </tr>
  925. </tbody>
  926. </table>
  927. <h5 class="returns">Returns</h5>
  928. <table class="table table-bordered table-striped table-condensed">
  929. <thead>
  930. <tr>
  931. <th>Type</th>
  932. <th>Description</th>
  933. </tr>
  934. </thead>
  935. <tbody>
  936. <tr>
  937. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">NStack.ustring</span>&gt;</td>
  938. <td>A list of word wrapped lines.</td>
  939. </tr>
  940. </tbody>
  941. </table>
  942. <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>
  943. <div class="markdown level1 remarks">
  944. <p>
  945. An empty <code>text</code> string will result in one empty line.
  946. </p>
  947. <p>
  948. If <code>width</code> is 0, a single, empty line will be returned.
  949. </p>
  950. <p>
  951. If <code>width</code> is int.MaxValue, the text will be formatted to the maximum width possible.
  952. </p>
  953. </div>
  954. <a id="Terminal_Gui_TextFormatter_GetMaxLengthForWidth_" data-uid="Terminal.Gui.TextFormatter.GetMaxLengthForWidth*"></a>
  955. <h4 id="Terminal_Gui_TextFormatter_GetMaxLengthForWidth_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.GetMaxLengthForWidth(NStack.ustring,System.Int32)">GetMaxLengthForWidth(ustring, Int32)</h4>
  956. <div class="markdown level1 summary">
  957. Gets the index position from the text based on the <code data-dev-comment-type="paramref" class="paramref">width</code>.
  958. </div>
  959. <div class="markdown level1 conceptual"></div>
  960. <h5 class="decalaration">Declaration</h5>
  961. <div class="codewrapper">
  962. <pre><code class="lang-csharp hljs">public static int GetMaxLengthForWidth(ustring text, int width)</code></pre>
  963. </div>
  964. <h5 class="parameters">Parameters</h5>
  965. <table class="table table-bordered table-striped table-condensed">
  966. <thead>
  967. <tr>
  968. <th>Type</th>
  969. <th>Name</th>
  970. <th>Description</th>
  971. </tr>
  972. </thead>
  973. <tbody>
  974. <tr>
  975. <td><span class="xref">NStack.ustring</span></td>
  976. <td><span class="parametername">text</span></td>
  977. <td>The text.</td>
  978. </tr>
  979. <tr>
  980. <td><span class="xref">System.Int32</span></td>
  981. <td><span class="parametername">width</span></td>
  982. <td>The width.</td>
  983. </tr>
  984. </tbody>
  985. </table>
  986. <h5 class="returns">Returns</h5>
  987. <table class="table table-bordered table-striped table-condensed">
  988. <thead>
  989. <tr>
  990. <th>Type</th>
  991. <th>Description</th>
  992. </tr>
  993. </thead>
  994. <tbody>
  995. <tr>
  996. <td><span class="xref">System.Int32</span></td>
  997. <td>The index of the text that fit the width.</td>
  998. </tr>
  999. </tbody>
  1000. </table>
  1001. <a id="Terminal_Gui_TextFormatter_GetMaxLengthForWidth_" data-uid="Terminal.Gui.TextFormatter.GetMaxLengthForWidth*"></a>
  1002. <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>
  1003. <div class="markdown level1 summary">
  1004. Gets the index position from the list based on the <code data-dev-comment-type="paramref" class="paramref">width</code>.
  1005. </div>
  1006. <div class="markdown level1 conceptual"></div>
  1007. <h5 class="decalaration">Declaration</h5>
  1008. <div class="codewrapper">
  1009. <pre><code class="lang-csharp hljs">public static int GetMaxLengthForWidth(List&lt;Rune&gt; runes, int width)</code></pre>
  1010. </div>
  1011. <h5 class="parameters">Parameters</h5>
  1012. <table class="table table-bordered table-striped table-condensed">
  1013. <thead>
  1014. <tr>
  1015. <th>Type</th>
  1016. <th>Name</th>
  1017. <th>Description</th>
  1018. </tr>
  1019. </thead>
  1020. <tbody>
  1021. <tr>
  1022. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">System.Rune</span>&gt;</td>
  1023. <td><span class="parametername">runes</span></td>
  1024. <td>The runes.</td>
  1025. </tr>
  1026. <tr>
  1027. <td><span class="xref">System.Int32</span></td>
  1028. <td><span class="parametername">width</span></td>
  1029. <td>The width.</td>
  1030. </tr>
  1031. </tbody>
  1032. </table>
  1033. <h5 class="returns">Returns</h5>
  1034. <table class="table table-bordered table-striped table-condensed">
  1035. <thead>
  1036. <tr>
  1037. <th>Type</th>
  1038. <th>Description</th>
  1039. </tr>
  1040. </thead>
  1041. <tbody>
  1042. <tr>
  1043. <td><span class="xref">System.Int32</span></td>
  1044. <td>The index of the list that fit the width.</td>
  1045. </tr>
  1046. </tbody>
  1047. </table>
  1048. <a id="Terminal_Gui_TextFormatter_GetSumMaxCharWidth_" data-uid="Terminal.Gui.TextFormatter.GetSumMaxCharWidth*"></a>
  1049. <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>
  1050. <div class="markdown level1 summary">
  1051. Gets the maximum characters width from the text based on the <code data-dev-comment-type="paramref" class="paramref">startIndex</code>
  1052. and the <code data-dev-comment-type="paramref" class="paramref">length</code>.
  1053. </div>
  1054. <div class="markdown level1 conceptual"></div>
  1055. <h5 class="decalaration">Declaration</h5>
  1056. <div class="codewrapper">
  1057. <pre><code class="lang-csharp hljs">public static int GetSumMaxCharWidth(ustring text, int startIndex = -1, int length = -1)</code></pre>
  1058. </div>
  1059. <h5 class="parameters">Parameters</h5>
  1060. <table class="table table-bordered table-striped table-condensed">
  1061. <thead>
  1062. <tr>
  1063. <th>Type</th>
  1064. <th>Name</th>
  1065. <th>Description</th>
  1066. </tr>
  1067. </thead>
  1068. <tbody>
  1069. <tr>
  1070. <td><span class="xref">NStack.ustring</span></td>
  1071. <td><span class="parametername">text</span></td>
  1072. <td>The text.</td>
  1073. </tr>
  1074. <tr>
  1075. <td><span class="xref">System.Int32</span></td>
  1076. <td><span class="parametername">startIndex</span></td>
  1077. <td>The start index.</td>
  1078. </tr>
  1079. <tr>
  1080. <td><span class="xref">System.Int32</span></td>
  1081. <td><span class="parametername">length</span></td>
  1082. <td>The length.</td>
  1083. </tr>
  1084. </tbody>
  1085. </table>
  1086. <h5 class="returns">Returns</h5>
  1087. <table class="table table-bordered table-striped table-condensed">
  1088. <thead>
  1089. <tr>
  1090. <th>Type</th>
  1091. <th>Description</th>
  1092. </tr>
  1093. </thead>
  1094. <tbody>
  1095. <tr>
  1096. <td><span class="xref">System.Int32</span></td>
  1097. <td>The maximum characters width.</td>
  1098. </tr>
  1099. </tbody>
  1100. </table>
  1101. <a id="Terminal_Gui_TextFormatter_GetSumMaxCharWidth_" data-uid="Terminal.Gui.TextFormatter.GetSumMaxCharWidth*"></a>
  1102. <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>
  1103. <div class="markdown level1 summary">
  1104. Gets the maximum characters width from the list based on the <code data-dev-comment-type="paramref" class="paramref">startIndex</code>
  1105. and the <code data-dev-comment-type="paramref" class="paramref">length</code>.
  1106. </div>
  1107. <div class="markdown level1 conceptual"></div>
  1108. <h5 class="decalaration">Declaration</h5>
  1109. <div class="codewrapper">
  1110. <pre><code class="lang-csharp hljs">public static int GetSumMaxCharWidth(List&lt;ustring&gt; lines, int startIndex = -1, int length = -1)</code></pre>
  1111. </div>
  1112. <h5 class="parameters">Parameters</h5>
  1113. <table class="table table-bordered table-striped table-condensed">
  1114. <thead>
  1115. <tr>
  1116. <th>Type</th>
  1117. <th>Name</th>
  1118. <th>Description</th>
  1119. </tr>
  1120. </thead>
  1121. <tbody>
  1122. <tr>
  1123. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">NStack.ustring</span>&gt;</td>
  1124. <td><span class="parametername">lines</span></td>
  1125. <td>The lines.</td>
  1126. </tr>
  1127. <tr>
  1128. <td><span class="xref">System.Int32</span></td>
  1129. <td><span class="parametername">startIndex</span></td>
  1130. <td>The start index.</td>
  1131. </tr>
  1132. <tr>
  1133. <td><span class="xref">System.Int32</span></td>
  1134. <td><span class="parametername">length</span></td>
  1135. <td>The length.</td>
  1136. </tr>
  1137. </tbody>
  1138. </table>
  1139. <h5 class="returns">Returns</h5>
  1140. <table class="table table-bordered table-striped table-condensed">
  1141. <thead>
  1142. <tr>
  1143. <th>Type</th>
  1144. <th>Description</th>
  1145. </tr>
  1146. </thead>
  1147. <tbody>
  1148. <tr>
  1149. <td><span class="xref">System.Int32</span></td>
  1150. <td>The maximum characters width.</td>
  1151. </tr>
  1152. </tbody>
  1153. </table>
  1154. <a id="Terminal_Gui_TextFormatter_GetTextWidth_" data-uid="Terminal.Gui.TextFormatter.GetTextWidth*"></a>
  1155. <h4 id="Terminal_Gui_TextFormatter_GetTextWidth_NStack_ustring_" data-uid="Terminal.Gui.TextFormatter.GetTextWidth(NStack.ustring)">GetTextWidth(ustring)</h4>
  1156. <div class="markdown level1 summary">
  1157. Gets the total width of the passed text.
  1158. </div>
  1159. <div class="markdown level1 conceptual"></div>
  1160. <h5 class="decalaration">Declaration</h5>
  1161. <div class="codewrapper">
  1162. <pre><code class="lang-csharp hljs">public static int GetTextWidth(ustring text)</code></pre>
  1163. </div>
  1164. <h5 class="parameters">Parameters</h5>
  1165. <table class="table table-bordered table-striped table-condensed">
  1166. <thead>
  1167. <tr>
  1168. <th>Type</th>
  1169. <th>Name</th>
  1170. <th>Description</th>
  1171. </tr>
  1172. </thead>
  1173. <tbody>
  1174. <tr>
  1175. <td><span class="xref">NStack.ustring</span></td>
  1176. <td><span class="parametername">text</span></td>
  1177. <td></td>
  1178. </tr>
  1179. </tbody>
  1180. </table>
  1181. <h5 class="returns">Returns</h5>
  1182. <table class="table table-bordered table-striped table-condensed">
  1183. <thead>
  1184. <tr>
  1185. <th>Type</th>
  1186. <th>Description</th>
  1187. </tr>
  1188. </thead>
  1189. <tbody>
  1190. <tr>
  1191. <td><span class="xref">System.Int32</span></td>
  1192. <td>The text width.</td>
  1193. </tr>
  1194. </tbody>
  1195. </table>
  1196. <a id="Terminal_Gui_TextFormatter_IsHorizontalDirection_" data-uid="Terminal.Gui.TextFormatter.IsHorizontalDirection*"></a>
  1197. <h4 id="Terminal_Gui_TextFormatter_IsHorizontalDirection_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.IsHorizontalDirection(Terminal.Gui.TextDirection)">IsHorizontalDirection(TextDirection)</h4>
  1198. <div class="markdown level1 summary">
  1199. Check if it is a horizontal direction
  1200. </div>
  1201. <div class="markdown level1 conceptual"></div>
  1202. <h5 class="decalaration">Declaration</h5>
  1203. <div class="codewrapper">
  1204. <pre><code class="lang-csharp hljs">public static bool IsHorizontalDirection(TextDirection textDirection)</code></pre>
  1205. </div>
  1206. <h5 class="parameters">Parameters</h5>
  1207. <table class="table table-bordered table-striped table-condensed">
  1208. <thead>
  1209. <tr>
  1210. <th>Type</th>
  1211. <th>Name</th>
  1212. <th>Description</th>
  1213. </tr>
  1214. </thead>
  1215. <tbody>
  1216. <tr>
  1217. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1218. <td><span class="parametername">textDirection</span></td>
  1219. <td></td>
  1220. </tr>
  1221. </tbody>
  1222. </table>
  1223. <h5 class="returns">Returns</h5>
  1224. <table class="table table-bordered table-striped table-condensed">
  1225. <thead>
  1226. <tr>
  1227. <th>Type</th>
  1228. <th>Description</th>
  1229. </tr>
  1230. </thead>
  1231. <tbody>
  1232. <tr>
  1233. <td><span class="xref">System.Boolean</span></td>
  1234. <td></td>
  1235. </tr>
  1236. </tbody>
  1237. </table>
  1238. <a id="Terminal_Gui_TextFormatter_IsLeftToRight_" data-uid="Terminal.Gui.TextFormatter.IsLeftToRight*"></a>
  1239. <h4 id="Terminal_Gui_TextFormatter_IsLeftToRight_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.IsLeftToRight(Terminal.Gui.TextDirection)">IsLeftToRight(TextDirection)</h4>
  1240. <div class="markdown level1 summary">
  1241. Check if it is Left to Right direction
  1242. </div>
  1243. <div class="markdown level1 conceptual"></div>
  1244. <h5 class="decalaration">Declaration</h5>
  1245. <div class="codewrapper">
  1246. <pre><code class="lang-csharp hljs">public static bool IsLeftToRight(TextDirection textDirection)</code></pre>
  1247. </div>
  1248. <h5 class="parameters">Parameters</h5>
  1249. <table class="table table-bordered table-striped table-condensed">
  1250. <thead>
  1251. <tr>
  1252. <th>Type</th>
  1253. <th>Name</th>
  1254. <th>Description</th>
  1255. </tr>
  1256. </thead>
  1257. <tbody>
  1258. <tr>
  1259. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1260. <td><span class="parametername">textDirection</span></td>
  1261. <td></td>
  1262. </tr>
  1263. </tbody>
  1264. </table>
  1265. <h5 class="returns">Returns</h5>
  1266. <table class="table table-bordered table-striped table-condensed">
  1267. <thead>
  1268. <tr>
  1269. <th>Type</th>
  1270. <th>Description</th>
  1271. </tr>
  1272. </thead>
  1273. <tbody>
  1274. <tr>
  1275. <td><span class="xref">System.Boolean</span></td>
  1276. <td></td>
  1277. </tr>
  1278. </tbody>
  1279. </table>
  1280. <a id="Terminal_Gui_TextFormatter_IsTopToBottom_" data-uid="Terminal.Gui.TextFormatter.IsTopToBottom*"></a>
  1281. <h4 id="Terminal_Gui_TextFormatter_IsTopToBottom_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.IsTopToBottom(Terminal.Gui.TextDirection)">IsTopToBottom(TextDirection)</h4>
  1282. <div class="markdown level1 summary">
  1283. Check if it is Top to Bottom direction
  1284. </div>
  1285. <div class="markdown level1 conceptual"></div>
  1286. <h5 class="decalaration">Declaration</h5>
  1287. <div class="codewrapper">
  1288. <pre><code class="lang-csharp hljs">public static bool IsTopToBottom(TextDirection textDirection)</code></pre>
  1289. </div>
  1290. <h5 class="parameters">Parameters</h5>
  1291. <table class="table table-bordered table-striped table-condensed">
  1292. <thead>
  1293. <tr>
  1294. <th>Type</th>
  1295. <th>Name</th>
  1296. <th>Description</th>
  1297. </tr>
  1298. </thead>
  1299. <tbody>
  1300. <tr>
  1301. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1302. <td><span class="parametername">textDirection</span></td>
  1303. <td></td>
  1304. </tr>
  1305. </tbody>
  1306. </table>
  1307. <h5 class="returns">Returns</h5>
  1308. <table class="table table-bordered table-striped table-condensed">
  1309. <thead>
  1310. <tr>
  1311. <th>Type</th>
  1312. <th>Description</th>
  1313. </tr>
  1314. </thead>
  1315. <tbody>
  1316. <tr>
  1317. <td><span class="xref">System.Boolean</span></td>
  1318. <td></td>
  1319. </tr>
  1320. </tbody>
  1321. </table>
  1322. <a id="Terminal_Gui_TextFormatter_IsVerticalDirection_" data-uid="Terminal.Gui.TextFormatter.IsVerticalDirection*"></a>
  1323. <h4 id="Terminal_Gui_TextFormatter_IsVerticalDirection_Terminal_Gui_TextDirection_" data-uid="Terminal.Gui.TextFormatter.IsVerticalDirection(Terminal.Gui.TextDirection)">IsVerticalDirection(TextDirection)</h4>
  1324. <div class="markdown level1 summary">
  1325. Check if it is a vertical direction
  1326. </div>
  1327. <div class="markdown level1 conceptual"></div>
  1328. <h5 class="decalaration">Declaration</h5>
  1329. <div class="codewrapper">
  1330. <pre><code class="lang-csharp hljs">public static bool IsVerticalDirection(TextDirection textDirection)</code></pre>
  1331. </div>
  1332. <h5 class="parameters">Parameters</h5>
  1333. <table class="table table-bordered table-striped table-condensed">
  1334. <thead>
  1335. <tr>
  1336. <th>Type</th>
  1337. <th>Name</th>
  1338. <th>Description</th>
  1339. </tr>
  1340. </thead>
  1341. <tbody>
  1342. <tr>
  1343. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1344. <td><span class="parametername">textDirection</span></td>
  1345. <td></td>
  1346. </tr>
  1347. </tbody>
  1348. </table>
  1349. <h5 class="returns">Returns</h5>
  1350. <table class="table table-bordered table-striped table-condensed">
  1351. <thead>
  1352. <tr>
  1353. <th>Type</th>
  1354. <th>Description</th>
  1355. </tr>
  1356. </thead>
  1357. <tbody>
  1358. <tr>
  1359. <td><span class="xref">System.Boolean</span></td>
  1360. <td></td>
  1361. </tr>
  1362. </tbody>
  1363. </table>
  1364. <a id="Terminal_Gui_TextFormatter_Justify_" data-uid="Terminal.Gui.TextFormatter.Justify*"></a>
  1365. <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>
  1366. <div class="markdown level1 summary">
  1367. Justifies the text to fill the width provided. Space will be added between words (demarked by spaces and tabs) to
  1368. make the text just fit <code>width</code>. Spaces will not be added to the ends.
  1369. </div>
  1370. <div class="markdown level1 conceptual"></div>
  1371. <h5 class="decalaration">Declaration</h5>
  1372. <div class="codewrapper">
  1373. <pre><code class="lang-csharp hljs">public static ustring Justify(ustring text, int width, char spaceChar = ' ', TextDirection textDirection = TextDirection.LeftRight_TopBottom)</code></pre>
  1374. </div>
  1375. <h5 class="parameters">Parameters</h5>
  1376. <table class="table table-bordered table-striped table-condensed">
  1377. <thead>
  1378. <tr>
  1379. <th>Type</th>
  1380. <th>Name</th>
  1381. <th>Description</th>
  1382. </tr>
  1383. </thead>
  1384. <tbody>
  1385. <tr>
  1386. <td><span class="xref">NStack.ustring</span></td>
  1387. <td><span class="parametername">text</span></td>
  1388. <td></td>
  1389. </tr>
  1390. <tr>
  1391. <td><span class="xref">System.Int32</span></td>
  1392. <td><span class="parametername">width</span></td>
  1393. <td></td>
  1394. </tr>
  1395. <tr>
  1396. <td><span class="xref">System.Char</span></td>
  1397. <td><span class="parametername">spaceChar</span></td>
  1398. <td>Character to replace whitespace and pad with. For debugging purposes.</td>
  1399. </tr>
  1400. <tr>
  1401. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1402. <td><span class="parametername">textDirection</span></td>
  1403. <td>The text direction.</td>
  1404. </tr>
  1405. </tbody>
  1406. </table>
  1407. <h5 class="returns">Returns</h5>
  1408. <table class="table table-bordered table-striped table-condensed">
  1409. <thead>
  1410. <tr>
  1411. <th>Type</th>
  1412. <th>Description</th>
  1413. </tr>
  1414. </thead>
  1415. <tbody>
  1416. <tr>
  1417. <td><span class="xref">NStack.ustring</span></td>
  1418. <td>The justified text.</td>
  1419. </tr>
  1420. </tbody>
  1421. </table>
  1422. <a id="Terminal_Gui_TextFormatter_MaxLines_" data-uid="Terminal.Gui.TextFormatter.MaxLines*"></a>
  1423. <h4 id="Terminal_Gui_TextFormatter_MaxLines_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.MaxLines(NStack.ustring,System.Int32)">MaxLines(ustring, Int32)</h4>
  1424. <div class="markdown level1 summary">
  1425. Computes the number of lines needed to render the specified text given the width.
  1426. </div>
  1427. <div class="markdown level1 conceptual"></div>
  1428. <h5 class="decalaration">Declaration</h5>
  1429. <div class="codewrapper">
  1430. <pre><code class="lang-csharp hljs">public static int MaxLines(ustring text, int width)</code></pre>
  1431. </div>
  1432. <h5 class="parameters">Parameters</h5>
  1433. <table class="table table-bordered table-striped table-condensed">
  1434. <thead>
  1435. <tr>
  1436. <th>Type</th>
  1437. <th>Name</th>
  1438. <th>Description</th>
  1439. </tr>
  1440. </thead>
  1441. <tbody>
  1442. <tr>
  1443. <td><span class="xref">NStack.ustring</span></td>
  1444. <td><span class="parametername">text</span></td>
  1445. <td>Text, may contain newlines.</td>
  1446. </tr>
  1447. <tr>
  1448. <td><span class="xref">System.Int32</span></td>
  1449. <td><span class="parametername">width</span></td>
  1450. <td>The minimum width for the text.</td>
  1451. </tr>
  1452. </tbody>
  1453. </table>
  1454. <h5 class="returns">Returns</h5>
  1455. <table class="table table-bordered table-striped table-condensed">
  1456. <thead>
  1457. <tr>
  1458. <th>Type</th>
  1459. <th>Description</th>
  1460. </tr>
  1461. </thead>
  1462. <tbody>
  1463. <tr>
  1464. <td><span class="xref">System.Int32</span></td>
  1465. <td>Number of lines.</td>
  1466. </tr>
  1467. </tbody>
  1468. </table>
  1469. <a id="Terminal_Gui_TextFormatter_MaxWidth_" data-uid="Terminal.Gui.TextFormatter.MaxWidth*"></a>
  1470. <h4 id="Terminal_Gui_TextFormatter_MaxWidth_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.MaxWidth(NStack.ustring,System.Int32)">MaxWidth(ustring, Int32)</h4>
  1471. <div class="markdown level1 summary">
  1472. Computes the maximum width needed to render the text (single line or multiple lines) given a minimum width.
  1473. </div>
  1474. <div class="markdown level1 conceptual"></div>
  1475. <h5 class="decalaration">Declaration</h5>
  1476. <div class="codewrapper">
  1477. <pre><code class="lang-csharp hljs">public static int MaxWidth(ustring text, int width)</code></pre>
  1478. </div>
  1479. <h5 class="parameters">Parameters</h5>
  1480. <table class="table table-bordered table-striped table-condensed">
  1481. <thead>
  1482. <tr>
  1483. <th>Type</th>
  1484. <th>Name</th>
  1485. <th>Description</th>
  1486. </tr>
  1487. </thead>
  1488. <tbody>
  1489. <tr>
  1490. <td><span class="xref">NStack.ustring</span></td>
  1491. <td><span class="parametername">text</span></td>
  1492. <td>Text, may contain newlines.</td>
  1493. </tr>
  1494. <tr>
  1495. <td><span class="xref">System.Int32</span></td>
  1496. <td><span class="parametername">width</span></td>
  1497. <td>The minimum width for the text.</td>
  1498. </tr>
  1499. </tbody>
  1500. </table>
  1501. <h5 class="returns">Returns</h5>
  1502. <table class="table table-bordered table-striped table-condensed">
  1503. <thead>
  1504. <tr>
  1505. <th>Type</th>
  1506. <th>Description</th>
  1507. </tr>
  1508. </thead>
  1509. <tbody>
  1510. <tr>
  1511. <td><span class="xref">System.Int32</span></td>
  1512. <td>Max width of lines.</td>
  1513. </tr>
  1514. </tbody>
  1515. </table>
  1516. <a id="Terminal_Gui_TextFormatter_RemoveHotKeySpecifier_" data-uid="Terminal.Gui.TextFormatter.RemoveHotKeySpecifier*"></a>
  1517. <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>
  1518. <div class="markdown level1 summary">
  1519. Removes the hotkey specifier from text.
  1520. </div>
  1521. <div class="markdown level1 conceptual"></div>
  1522. <h5 class="decalaration">Declaration</h5>
  1523. <div class="codewrapper">
  1524. <pre><code class="lang-csharp hljs">public static ustring RemoveHotKeySpecifier(ustring text, int hotPos, Rune hotKeySpecifier)</code></pre>
  1525. </div>
  1526. <h5 class="parameters">Parameters</h5>
  1527. <table class="table table-bordered table-striped table-condensed">
  1528. <thead>
  1529. <tr>
  1530. <th>Type</th>
  1531. <th>Name</th>
  1532. <th>Description</th>
  1533. </tr>
  1534. </thead>
  1535. <tbody>
  1536. <tr>
  1537. <td><span class="xref">NStack.ustring</span></td>
  1538. <td><span class="parametername">text</span></td>
  1539. <td>The text to manipulate.</td>
  1540. </tr>
  1541. <tr>
  1542. <td><span class="xref">System.Int32</span></td>
  1543. <td><span class="parametername">hotPos</span></td>
  1544. <td>Returns the position of the hot-key in the text. -1 if not found.</td>
  1545. </tr>
  1546. <tr>
  1547. <td><span class="xref">System.Rune</span></td>
  1548. <td><span class="parametername">hotKeySpecifier</span></td>
  1549. <td>The hot-key specifier (e.g. &apos;_&apos;) to look for.</td>
  1550. </tr>
  1551. </tbody>
  1552. </table>
  1553. <h5 class="returns">Returns</h5>
  1554. <table class="table table-bordered table-striped table-condensed">
  1555. <thead>
  1556. <tr>
  1557. <th>Type</th>
  1558. <th>Description</th>
  1559. </tr>
  1560. </thead>
  1561. <tbody>
  1562. <tr>
  1563. <td><span class="xref">NStack.ustring</span></td>
  1564. <td>The input text with the hotkey specifier (&apos;_&apos;) removed.</td>
  1565. </tr>
  1566. </tbody>
  1567. </table>
  1568. <a id="Terminal_Gui_TextFormatter_ReplaceHotKeyWithTag_" data-uid="Terminal.Gui.TextFormatter.ReplaceHotKeyWithTag*"></a>
  1569. <h4 id="Terminal_Gui_TextFormatter_ReplaceHotKeyWithTag_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.ReplaceHotKeyWithTag(NStack.ustring,System.Int32)">ReplaceHotKeyWithTag(ustring, Int32)</h4>
  1570. <div class="markdown level1 summary">
  1571. Replaces the Rune at the index specified by the <code>hotPos</code> parameter with a tag identifying
  1572. it as the hotkey.
  1573. </div>
  1574. <div class="markdown level1 conceptual"></div>
  1575. <h5 class="decalaration">Declaration</h5>
  1576. <div class="codewrapper">
  1577. <pre><code class="lang-csharp hljs">public ustring ReplaceHotKeyWithTag(ustring text, int hotPos)</code></pre>
  1578. </div>
  1579. <h5 class="parameters">Parameters</h5>
  1580. <table class="table table-bordered table-striped table-condensed">
  1581. <thead>
  1582. <tr>
  1583. <th>Type</th>
  1584. <th>Name</th>
  1585. <th>Description</th>
  1586. </tr>
  1587. </thead>
  1588. <tbody>
  1589. <tr>
  1590. <td><span class="xref">NStack.ustring</span></td>
  1591. <td><span class="parametername">text</span></td>
  1592. <td>The text to tag the hotkey in.</td>
  1593. </tr>
  1594. <tr>
  1595. <td><span class="xref">System.Int32</span></td>
  1596. <td><span class="parametername">hotPos</span></td>
  1597. <td>The Rune index of the hotkey in <code>text</code>.</td>
  1598. </tr>
  1599. </tbody>
  1600. </table>
  1601. <h5 class="returns">Returns</h5>
  1602. <table class="table table-bordered table-striped table-condensed">
  1603. <thead>
  1604. <tr>
  1605. <th>Type</th>
  1606. <th>Description</th>
  1607. </tr>
  1608. </thead>
  1609. <tbody>
  1610. <tr>
  1611. <td><span class="xref">NStack.ustring</span></td>
  1612. <td>The text with the hotkey tagged.</td>
  1613. </tr>
  1614. </tbody>
  1615. </table>
  1616. <h5 id="Terminal_Gui_TextFormatter_ReplaceHotKeyWithTag_NStack_ustring_System_Int32__remarks">Remarks</h5>
  1617. <div class="markdown level1 remarks">
  1618. The returned string will not render correctly without first un-doing the tag. To undo the tag, search for
  1619. Runes with a bitmask of <code>otKeyTagMask</code> and remove that bitmask.
  1620. </div>
  1621. <a id="Terminal_Gui_TextFormatter_WordWrap_" data-uid="Terminal.Gui.TextFormatter.WordWrap*"></a>
  1622. <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>
  1623. <div class="markdown level1 summary">
  1624. Formats the provided text to fit within the width provided using word wrapping.
  1625. </div>
  1626. <div class="markdown level1 conceptual"></div>
  1627. <h5 class="decalaration">Declaration</h5>
  1628. <div class="codewrapper">
  1629. <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>
  1630. </div>
  1631. <h5 class="parameters">Parameters</h5>
  1632. <table class="table table-bordered table-striped table-condensed">
  1633. <thead>
  1634. <tr>
  1635. <th>Type</th>
  1636. <th>Name</th>
  1637. <th>Description</th>
  1638. </tr>
  1639. </thead>
  1640. <tbody>
  1641. <tr>
  1642. <td><span class="xref">NStack.ustring</span></td>
  1643. <td><span class="parametername">text</span></td>
  1644. <td>The text to word wrap</td>
  1645. </tr>
  1646. <tr>
  1647. <td><span class="xref">System.Int32</span></td>
  1648. <td><span class="parametername">width</span></td>
  1649. <td>The width to contain the text to</td>
  1650. </tr>
  1651. <tr>
  1652. <td><span class="xref">System.Boolean</span></td>
  1653. <td><span class="parametername">preserveTrailingSpaces</span></td>
  1654. <td>If <code>true</code>, the wrapped text will keep the trailing spaces.
  1655. If <code>false</code>, the trailing spaces will be trimmed.</td>
  1656. </tr>
  1657. <tr>
  1658. <td><span class="xref">System.Int32</span></td>
  1659. <td><span class="parametername">tabWidth</span></td>
  1660. <td>The tab width.</td>
  1661. </tr>
  1662. <tr>
  1663. <td><a class="xref" href="Terminal.Gui.TextDirection.html">TextDirection</a></td>
  1664. <td><span class="parametername">textDirection</span></td>
  1665. <td>The text direction.</td>
  1666. </tr>
  1667. </tbody>
  1668. </table>
  1669. <h5 class="returns">Returns</h5>
  1670. <table class="table table-bordered table-striped table-condensed">
  1671. <thead>
  1672. <tr>
  1673. <th>Type</th>
  1674. <th>Description</th>
  1675. </tr>
  1676. </thead>
  1677. <tbody>
  1678. <tr>
  1679. <td><span class="xref">System.Collections.Generic.List</span>&lt;<span class="xref">NStack.ustring</span>&gt;</td>
  1680. <td>Returns a list of word wrapped lines.</td>
  1681. </tr>
  1682. </tbody>
  1683. </table>
  1684. <h5 id="Terminal_Gui_TextFormatter_WordWrap_NStack_ustring_System_Int32_System_Boolean_System_Int32_Terminal_Gui_TextDirection__remarks">Remarks</h5>
  1685. <div class="markdown level1 remarks">
  1686. <p>
  1687. This method does not do any justification.
  1688. </p>
  1689. <p>
  1690. This method strips Newline (&apos;\n&apos; and &apos;\r\n&apos;) sequences before processing.
  1691. </p>
  1692. </div>
  1693. <h3 id="events">Events
  1694. </h3>
  1695. <h4 id="Terminal_Gui_TextFormatter_HotKeyChanged" data-uid="Terminal.Gui.TextFormatter.HotKeyChanged">HotKeyChanged</h4>
  1696. <div class="markdown level1 summary">
  1697. Event invoked when the <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_HotKey">HotKey</a> is changed.
  1698. </div>
  1699. <div class="markdown level1 conceptual"></div>
  1700. <h5 class="decalaration">Declaration</h5>
  1701. <div class="codewrapper">
  1702. <pre><code class="lang-csharp hljs">public event Action&lt;Key&gt; HotKeyChanged</code></pre>
  1703. </div>
  1704. <h5 class="eventType">Event Type</h5>
  1705. <table class="table table-bordered table-striped table-condensed">
  1706. <thead>
  1707. <tr>
  1708. <th>Type</th>
  1709. <th>Description</th>
  1710. </tr>
  1711. </thead>
  1712. <tbody>
  1713. <tr>
  1714. <td><span class="xref">System.Action</span>&lt;<a class="xref" href="Terminal.Gui.Key.html">Key</a>&gt;</td>
  1715. <td></td>
  1716. </tr>
  1717. </tbody>
  1718. </table>
  1719. </article>
  1720. </div>
  1721. <div class="hidden-sm col-md-2" role="complementary">
  1722. <div class="sideaffix">
  1723. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  1724. <h5>In This Article</h5>
  1725. <div></div>
  1726. </nav>
  1727. </div>
  1728. </div>
  1729. </div>
  1730. </div>
  1731. <footer>
  1732. <div class="grad-bottom"></div>
  1733. <div class="footer">
  1734. <div class="container">
  1735. <span class="pull-right">
  1736. <a href="#top">Back to top</a>
  1737. </span>
  1738. <span>Generated by <strong>DocFX</strong></span>
  1739. </div>
  1740. </div>
  1741. </footer>
  1742. </div>
  1743. <script type="text/javascript" src="../../styles/docfx.vendor.js"></script>
  1744. <script type="text/javascript" src="../../styles/docfx.js"></script>
  1745. <script type="text/javascript" src="../../styles/main.js"></script>
  1746. </body>
  1747. </html>