Terminal.Gui.TextFormatter.html 70 KB

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