2
0

Terminal.Gui.TextFormatter.html 72 KB

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