/usr/share/doc/liblwt-ocaml-dev/api/Lwt_term.html is in liblwt-ocaml-doc 2.4.3-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Lwt_text.html">
<link rel="next" href="Lwt_read_line.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class attributes" rel=Appendix href="index_attributes.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of class types" rel=Appendix href="index_class_types.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Lwt_condition" rel="Chapter" href="Lwt_condition.html">
<link title="Lwt_list" rel="Chapter" href="Lwt_list.html">
<link title="Lwt" rel="Chapter" href="Lwt.html">
<link title="Lwt_mutex" rel="Chapter" href="Lwt_mutex.html">
<link title="Lwt_mvar" rel="Chapter" href="Lwt_mvar.html">
<link title="Lwt_pool" rel="Chapter" href="Lwt_pool.html">
<link title="Lwt_sequence" rel="Chapter" href="Lwt_sequence.html">
<link title="Lwt_stream" rel="Chapter" href="Lwt_stream.html">
<link title="Lwt_switch" rel="Chapter" href="Lwt_switch.html">
<link title="Lwt_util" rel="Chapter" href="Lwt_util.html">
<link title="Lwt_pqueue" rel="Chapter" href="Lwt_pqueue.html">
<link title="Lwt_lib" rel="Chapter" href="Lwt_lib.html">
<link title="Lwt_glib" rel="Chapter" href="Lwt_glib.html">
<link title="Lwt_preemptive" rel="Chapter" href="Lwt_preemptive.html">
<link title="Lwt_event" rel="Chapter" href="Lwt_event.html">
<link title="Lwt_signal" rel="Chapter" href="Lwt_signal.html">
<link title="Lwt_react" rel="Chapter" href="Lwt_react.html">
<link title="Lwt_ssl" rel="Chapter" href="Lwt_ssl.html">
<link title="Lwt_text" rel="Chapter" href="Lwt_text.html">
<link title="Lwt_term" rel="Chapter" href="Lwt_term.html">
<link title="Lwt_read_line" rel="Chapter" href="Lwt_read_line.html">
<link title="Lwt_top" rel="Chapter" href="Lwt_top.html">
<link title="Lwt_chan" rel="Chapter" href="Lwt_chan.html">
<link title="Lwt_daemon" rel="Chapter" href="Lwt_daemon.html">
<link title="Lwt_gc" rel="Chapter" href="Lwt_gc.html">
<link title="Lwt_io" rel="Chapter" href="Lwt_io.html">
<link title="Lwt_log" rel="Chapter" href="Lwt_log.html">
<link title="Lwt_main" rel="Chapter" href="Lwt_main.html">
<link title="Lwt_process" rel="Chapter" href="Lwt_process.html">
<link title="Lwt_throttle" rel="Chapter" href="Lwt_throttle.html">
<link title="Lwt_timeout" rel="Chapter" href="Lwt_timeout.html">
<link title="Lwt_unix" rel="Chapter" href="Lwt_unix.html">
<link title="Lwt_sys" rel="Chapter" href="Lwt_sys.html">
<link title="Lwt_engine" rel="Chapter" href="Lwt_engine.html">
<link title="Lwt_bytes" rel="Chapter" href="Lwt_bytes.html">
<link title="Pa_lwt" rel="Chapter" href="Pa_lwt.html">
<link title="Pa_lwt_log" rel="Chapter" href="Pa_lwt_log.html"><link title="Terminal informations" rel="Section" href="#6_Terminalinformations">
<link title="Keys" rel="Section" href="#6_Keys">
<link title="Styles" rel="Section" href="#6_Styles">
<link title="Rendering" rel="Section" href="#6_Rendering">
<link title="Drawing" rel="Section" href="#6_Drawing">
<link title="Standard colors" rel="Subsection" href="#8_Standardcolors">
<link title="Light colors" rel="Subsection" href="#8_Lightcolors">
<link title="Text with styles" rel="Subsection" href="#8_Textwithstyles">
<title>Lwt_term</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Lwt_text.html" title="Lwt_text">Previous</a>
<a class="up" href="index.html" title="Index">Up</a>
<a class="post" href="Lwt_read_line.html" title="Lwt_read_line">Next</a>
</div>
<h1>Module <a href="type_Lwt_term.html">Lwt_term</a></h1>
<pre><span class="keyword">module</span> Lwt_term: <code class="code"><span class="keyword">sig</span></code> <a href="Lwt_term.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top">
Terminal control<br>
</div>
<hr width="100%">
<br>
This modules allow you to write interactive programs using the
terminal.<br>
<pre><span id="VALwith_raw_mode"><span class="keyword">val</span> with_raw_mode</span> : <code class="type">(unit -> 'a <a href="Lwt.html#TYPEt">Lwt.t</a>) -> 'a <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">with_raw_mode f</code> executes <code class="code">f</code> while the terminal is in ``raw
mode''. Raw mode means that character are returned as the user
type them (otherwise only complete line are returned to the
program).
<p>
If the terminal is already in raw mode, it just calls <code class="code">f</code>.<br>
</div>
<pre><span id="VALraw_mode"><span class="keyword">val</span> raw_mode</span> : <code class="type">unit -> bool</code></pre><div class="info ">
Returns wether the terminal is currently in raw mode<br>
</div>
<pre><span id="VALenter_drawing_mode"><span class="keyword">val</span> enter_drawing_mode</span> : <code class="type">unit -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
Put the terminal into drawing mode<br>
</div>
<pre><span id="VALleave_drawing_mode"><span class="keyword">val</span> leave_drawing_mode</span> : <code class="type">unit -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
Restore the state of the terminal<br>
</div>
<pre><span id="VALshow_cursor"><span class="keyword">val</span> show_cursor</span> : <code class="type">unit -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">show_cursor ()</code> makes the cursor visible<br>
</div>
<pre><span id="VALhide_cursor"><span class="keyword">val</span> hide_cursor</span> : <code class="type">unit -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">hide_cursor ()</code> makes the cursor invisible<br>
</div>
<pre><span id="VALclear_screen"><span class="keyword">val</span> clear_screen</span> : <code class="type">unit -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">clear_screen ()</code> clears the entire screen<br>
</div>
<pre><span id="VALclear_line"><span class="keyword">val</span> clear_line</span> : <code class="type">unit -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">clear_line ()</code> clears the current line<br>
</div>
<pre><span id="VALgoto_beginning_of_line"><span class="keyword">val</span> goto_beginning_of_line</span> : <code class="type">int -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">goto_beginning_of_line n</code> put the cursor at the beginning of
the <code class="code">n</code>th previous line.
<p>
<ul>
<li><code class="code">goto_beginning_of_line 0</code> goes to the beginning of the current line</li>
<li><code class="code">goto_beginning_of_line 1</code> goes to the beginning of the previous line</li>
<li>...</li>
</ul>
<br>
</div>
<br>
<h6 id="6_Terminalinformations">Terminal informations</h6><br>
<pre><code><span id="TYPEsize"><span class="keyword">type</span> <code class="type"></code>size</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTsize.lines">lines</span> : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTsize.columns">columns</span> : <code class="type">int</code>;</code></td>
</tr></table>
}
<div class="info ">
Terminal sizes:<br>
</div>
<pre><span id="VALsize"><span class="keyword">val</span> size</span> : <code class="type"><a href="Lwt_term.html#TYPEsize">size</a> React.signal</code></pre><div class="info ">
Size of the terminal.<br>
</div>
<pre><span id="VALcolumns"><span class="keyword">val</span> columns</span> : <code class="type">int React.signal</code></pre><div class="info ">
Number of columns of the terminal<br>
</div>
<pre><span id="VALlines"><span class="keyword">val</span> lines</span> : <code class="type">int React.signal</code></pre><div class="info ">
Number of lines of the terminal<br>
</div>
<br>
<h6 id="6_Keys">Keys</h6><br>
<pre><span id="VALparse_key_raw"><span class="keyword">val</span> parse_key_raw</span> : <code class="type">Text.t <a href="Lwt_stream.html#TYPEt">Lwt_stream.t</a> -> Text.t <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">parse_key_raw st</code> recognize escape sequence in a stream of
unicode character.
<p>
It returns either:<ul>
<li>either single characters, like <code class="code"><span class="string">"a"</span></code>, <code class="code"><span class="string">"é"</span></code>, ...</li>
<li>either escape sequences</li>
</ul>
<br>
</div>
<pre><code><span id="TYPEkey"><span class="keyword">type</span> <code class="type"></code>key</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key"><span class="constructor">Key</span></span> <span class="keyword">of</span> <code class="type">Text.t</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >A unicode character or an uninterpreted sequence</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_up"><span class="constructor">Key_up</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_down"><span class="constructor">Key_down</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_left"><span class="constructor">Key_left</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_right"><span class="constructor">Key_right</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_f"><span class="constructor">Key_f</span></span> <span class="keyword">of</span> <code class="type">int</code></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_next_page"><span class="constructor">Key_next_page</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_previous_page"><span class="constructor">Key_previous_page</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_home"><span class="constructor">Key_home</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_end"><span class="constructor">Key_end</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_insert"><span class="constructor">Key_insert</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_delete"><span class="constructor">Key_delete</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkey.Key_control"><span class="constructor">Key_control</span></span> <span class="keyword">of</span> <code class="type">char</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >A control key</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>
<div class="info ">
Type of ``decoded'' keys.
<p>
This list is not exhaustive, but at least it should works on all
terminals:<br>
</div>
<pre><span id="VALstring_of_key"><span class="keyword">val</span> string_of_key</span> : <code class="type"><a href="Lwt_term.html#TYPEkey">key</a> -> string</code></pre><div class="info ">
<code class="code">string_of_key key</code> string representation of a key<br>
</div>
<pre><span id="VALcontrol_mapping"><span class="keyword">val</span> control_mapping</span> : <code class="type">(int * char) list</code></pre><div class="info ">
Mapping from control key codes to character codes.
<p>
Here is the list of control keys:
<p>
<pre class="codepre"><code class="code"> +------+-------+------+------+------+-------+------------------------------------------------+
| Char | Oct | Dec | Name | Hex | Key | Comment |
+------+-------+------+------+------+-------+------------------------------------------------+
| '@' | 0o00 | 0 | NUL | 0x00 | ^@ \0 | Null byte |
| 'a' | 0o01 | 1 | SOH | 0x01 | ^A | Start of heading |
| 'b' | 0o02 | 2 | STX | 0x02 | ^B | Start of text |
| 'c' | 0o03 | 3 | ETX | 0x03 | ^C | End of text |
| 'd' | 0o04 | 4 | EOT | 0x04 | ^D | End of transmission |
| 'e' | 0o05 | 5 | ENQ | 0x05 | ^E | Enquiry |
| 'f' | 0o06 | 6 | ACK | 0x06 | ^F | Acknowledge |
| 'g' | 0o07 | 7 | BEL | 0x07 | ^G | Ring terminal bell |
| 'h' | 0o10 | 8 | BS | 0x08 | ^H \b | Backspace |
| 'i' | 0o11 | 9 | HT | 0x09 | ^I \t | Horizontal tab |
| 'j' | 0o12 | 10 | LF | 0x0a | ^J \n | Line feed |
| 'k' | 0o13 | 11 | VT | 0x0b | ^K | Vertical tab |
| 'l' | 0o14 | 12 | FF | 0x0c | ^L \f | Form feed |
| 'm' | 0o15 | 13 | CR | 0x0d | ^M \r | Carriage return |
| 'n' | 0o16 | 14 | SO | 0x0e | ^N | Shift out |
| 'o' | 0o17 | 15 | SI | 0x0f | ^O | Shift in |
| 'p' | 0o20 | 16 | DLE | 0x10 | ^P | Data link escape |
| 'q' | 0o21 | 17 | DC1 | 0x11 | ^Q | Device control 1 (XON) |
| 'r' | 0o22 | 18 | DC2 | 0x12 | ^R | Device control 2 |
| 's' | 0o23 | 19 | DC3 | 0x13 | ^S | Device control 3 (XOFF) |
| 't' | 0o24 | 20 | DC4 | 0x14 | ^T | Device control 4 |
| 'u' | 0o25 | 21 | NAK | 0x15 | ^U | Negative acknowledge |
| 'v' | 0o26 | 22 | SYN | 0x16 | ^V | Synchronous idle |
| 'w' | 0o27 | 23 | ETB | 0x17 | ^W | End of transmission block |
| 'x' | 0o30 | 24 | CAN | 0x18 | ^X | Cancel |
| 'y' | 0o31 | 25 | EM | 0x19 | ^Y | End of medium |
| 'z' | 0o32 | 26 | SUB | 0x1a | ^Z | Substitute character |
| '[' | 0o33 | 27 | ESC | 0x1b | ^[ | Escape |
| '\' | 0o34 | 28 | FS | 0x1c | ^\ | File separator, Information separator four |
| ']' | 0o35 | 29 | GS | 0x1d | ^] | Group separator, Information separator three |
| '^' | 0o36 | 30 | RS | 0x1e | ^^ | Record separator, Information separator two |
| '_' | 0o37 | 31 | US | 0x1f | ^_ | Unit separator, Information separator one |
| '?' | 0o177 | 127 | DEL | 0x7f | ^? | Delete |
+------+-------+------+------+------+-------+------------------------------------------------+
</code></pre><br>
</div>
<pre><span id="VALkey_enter"><span class="keyword">val</span> key_enter</span> : <code class="type"><a href="Lwt_term.html#TYPEkey">key</a></code></pre><div class="info ">
<code class="code">key_enter = <span class="constructor">Key_control</span> <span class="string">'j'</span></code><br>
</div>
<pre><span id="VALkey_escape"><span class="keyword">val</span> key_escape</span> : <code class="type"><a href="Lwt_term.html#TYPEkey">key</a></code></pre><div class="info ">
<code class="code">key_escape = <span class="constructor">Key_control</span> <span class="string">'['</span></code><br>
</div>
<pre><span id="VALkey_tab"><span class="keyword">val</span> key_tab</span> : <code class="type"><a href="Lwt_term.html#TYPEkey">key</a></code></pre><div class="info ">
<code class="code">key_escape = <span class="constructor">Key_control</span> <span class="string">'i'</span></code><br>
</div>
<pre><span id="VALkey_backspace"><span class="keyword">val</span> key_backspace</span> : <code class="type"><a href="Lwt_term.html#TYPEkey">key</a></code></pre><div class="info ">
<code class="code">key_backspace = <span class="constructor">Key_control</span> <span class="string">'?'</span></code><br>
</div>
<pre><span id="VALsequence_mapping"><span class="keyword">val</span> sequence_mapping</span> : <code class="type">(Text.t * <a href="Lwt_term.html#TYPEkey">key</a>) list</code></pre><div class="info ">
Mapping from sequence to keys<br>
</div>
<pre><span id="VALdecode_key"><span class="keyword">val</span> decode_key</span> : <code class="type">Text.t -> <a href="Lwt_term.html#TYPEkey">key</a></code></pre><div class="info ">
Decode a key.<br>
</div>
<pre><span id="VALstandard_input"><span class="keyword">val</span> standard_input</span> : <code class="type">Text.t <a href="Lwt_stream.html#TYPEt">Lwt_stream.t</a></code></pre><div class="info ">
The input stream used by <a href="Lwt_term.html#VALread_key"><code class="code"><span class="constructor">Lwt_term</span>.read_key</code></a><br>
</div>
<pre><span id="VALread_key"><span class="keyword">val</span> read_key</span> : <code class="type">unit -> <a href="Lwt_term.html#TYPEkey">key</a> <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
Get and decode a key from <a href="Lwt_term.html#VALstandard_input"><code class="code"><span class="constructor">Lwt_term</span>.standard_input</code></a><br>
</div>
<br>
<h6 id="6_Styles">Styles</h6><br>
<pre><span id="TYPEcolor"><span class="keyword">type</span> <code class="type"></code>color</span> = <code class="type">int</code> </pre>
<div class="info ">
Type of a color. Most modern terminals support either 88 or
256 colors.<br>
</div>
<pre><span id="VALset_color"><span class="keyword">val</span> set_color</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a> -> int * int * int -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">set_color num (red, green, blue)</code> sets the three components of
the color number <code class="code">num</code><br>
</div>
<br>
<div class="h8" id="8_Standardcolors">Standard colors</div><br>
<pre><span id="VALdefault"><span class="keyword">val</span> default</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALblack"><span class="keyword">val</span> black</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALred"><span class="keyword">val</span> red</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALgreen"><span class="keyword">val</span> green</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALyellow"><span class="keyword">val</span> yellow</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALblue"><span class="keyword">val</span> blue</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALmagenta"><span class="keyword">val</span> magenta</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALcyan"><span class="keyword">val</span> cyan</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALwhite"><span class="keyword">val</span> white</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre><br>
<div class="h8" id="8_Lightcolors">Light colors</div><br>
<br>
Note: these colors are not supposed to works on all terminals, but
in practice it works with all modern ones. By the way, using
standard colors + bold mode will give the same result as using a
light color.<br>
<pre><span id="VALlblack"><span class="keyword">val</span> lblack</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALlred"><span class="keyword">val</span> lred</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALlgreen"><span class="keyword">val</span> lgreen</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALlyellow"><span class="keyword">val</span> lyellow</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALlblue"><span class="keyword">val</span> lblue</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALlmagenta"><span class="keyword">val</span> lmagenta</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALlcyan"><span class="keyword">val</span> lcyan</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre>
<pre><span id="VALlwhite"><span class="keyword">val</span> lwhite</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></pre><br>
<div class="h8" id="8_Textwithstyles">Text with styles</div><br>
<pre><code><span id="TYPEstyled_text_instruction"><span class="keyword">type</span> <code class="type"></code>styled_text_instruction</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyled_text_instruction.Text"><span class="constructor">Text</span></span> <span class="keyword">of</span> <code class="type">Text.t</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Some text</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyled_text_instruction.Reset"><span class="constructor">Reset</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Resets all styles to default</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyled_text_instruction.Bold"><span class="constructor">Bold</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyled_text_instruction.Underlined"><span class="constructor">Underlined</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyled_text_instruction.Blink"><span class="constructor">Blink</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyled_text_instruction.Inverse"><span class="constructor">Inverse</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyled_text_instruction.Hidden"><span class="constructor">Hidden</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyled_text_instruction.Foreground"><span class="constructor">Foreground</span></span> <span class="keyword">of</span> <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyled_text_instruction.Background"><span class="constructor">Background</span></span> <span class="keyword">of</span> <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code></code></td>
</tr></table>
<div class="info ">
Elmement of a styled-text<br>
</div>
<pre><span id="TYPEstyled_text"><span class="keyword">type</span> <code class="type"></code>styled_text</span> = <code class="type"><a href="Lwt_term.html#TYPEstyled_text_instruction">styled_text_instruction</a> list</code> </pre>
<div class="info ">
A styled text is a list of instructions<br>
</div>
<pre><span id="VALtextf"><span class="keyword">val</span> textf</span> : <code class="type">('a, unit, string, <a href="Lwt_term.html#TYPEstyled_text_instruction">styled_text_instruction</a>) Pervasives.format4 -> 'a</code></pre><div class="info ">
<code class="code">textf fmt</code> formats a texts with <code class="code">fmt</code> and returns <code class="code"><span class="constructor">Text</span> txt</code><br>
</div>
<pre><span id="VALtext"><span class="keyword">val</span> text</span> : <code class="type">Text.t -> <a href="Lwt_term.html#TYPEstyled_text_instruction">styled_text_instruction</a></code></pre>
<pre><span id="VALreset"><span class="keyword">val</span> reset</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text_instruction">styled_text_instruction</a></code></pre>
<pre><span id="VALbold"><span class="keyword">val</span> bold</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text_instruction">styled_text_instruction</a></code></pre>
<pre><span id="VALunderlined"><span class="keyword">val</span> underlined</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text_instruction">styled_text_instruction</a></code></pre>
<pre><span id="VALblink"><span class="keyword">val</span> blink</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text_instruction">styled_text_instruction</a></code></pre>
<pre><span id="VALinverse"><span class="keyword">val</span> inverse</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text_instruction">styled_text_instruction</a></code></pre>
<pre><span id="VALhidden"><span class="keyword">val</span> hidden</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text_instruction">styled_text_instruction</a></code></pre>
<pre><span id="VALfg"><span class="keyword">val</span> fg</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a> -> <a href="Lwt_term.html#TYPEstyled_text_instruction">styled_text_instruction</a></code></pre><div class="info ">
<code class="code">fg col = <span class="constructor">Foreground</span> col</code><br>
</div>
<pre><span id="VALbg"><span class="keyword">val</span> bg</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a> -> <a href="Lwt_term.html#TYPEstyled_text_instruction">styled_text_instruction</a></code></pre><div class="info ">
<code class="code">bg col = <span class="constructor">Background</span> col</code><br>
</div>
<pre><span id="VALstrip_styles"><span class="keyword">val</span> strip_styles</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text">styled_text</a> -> Text.t</code></pre><div class="info ">
Drop all styles<br>
</div>
<pre><span id="VALstyled_length"><span class="keyword">val</span> styled_length</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text">styled_text</a> -> int</code></pre><div class="info ">
Returns the length (in unicode character) of the given styled
text. The following equality holds for all styled-texts:
<p>
<code class="code">styled_length st = <span class="constructor">Text</span>.length (strip_styles st)</code><br>
</div>
<pre><span id="VALwrite_styled"><span class="keyword">val</span> write_styled</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">Lwt_text.output_channel</a> -> <a href="Lwt_term.html#TYPEstyled_text">styled_text</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">write_styled oc st</code> writes <code class="code">st</code> on <code class="code">oc</code> using escape
sequences.<br>
</div>
<pre><span id="VALprintc"><span class="keyword">val</span> printc</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text">styled_text</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">printc st</code> prints the given styled text on standard output. If
stdout is not a tty, then styles are stripped.
<p>
The text is encoded to the system encoding before being
output.<br>
</div>
<pre><span id="VALeprintc"><span class="keyword">val</span> eprintc</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text">styled_text</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
Same as <code class="code">printc</code> but prints on stderr.<br>
</div>
<pre><span id="VALprintlc"><span class="keyword">val</span> printlc</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text">styled_text</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">printlc st</code> prints <code class="code">st</code>, then reset styles and prints a
newline<br>
</div>
<pre><span id="VALeprintlc"><span class="keyword">val</span> eprintlc</span> : <code class="type"><a href="Lwt_term.html#TYPEstyled_text">styled_text</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
Same as <code class="code">printlc</code> but prints on stderr<br>
</div>
<br>
<h6 id="6_Rendering">Rendering</h6><br>
<pre><code><span id="TYPEstyle"><span class="keyword">type</span> <code class="type"></code>style</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyle.bold">bold</span> : <code class="type">bool</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyle.underlined">underlined</span> : <code class="type">bool</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyle.blink">blink</span> : <code class="type">bool</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyle.inverse">inverse</span> : <code class="type">bool</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyle.hidden">hidden</span> : <code class="type">bool</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyle.foreground">foreground</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTstyle.background">background</span> : <code class="type"><a href="Lwt_term.html#TYPEcolor">color</a></code>;</code></td>
</tr></table>
}
<div class="info ">
Character styles<br>
</div>
<pre><code><span id="TYPEpoint"><span class="keyword">type</span> <code class="type"></code>point</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTpoint.char">char</span> : <code class="type">Text.t</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The character.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTpoint.style">style</span> : <code class="type"><a href="Lwt_term.html#TYPEstyle">style</a></code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The character style</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>
}
<div class="info ">
A character on the screen:<br>
</div>
<pre><span id="VALblank"><span class="keyword">val</span> blank</span> : <code class="type"><a href="Lwt_term.html#TYPEpoint">point</a></code></pre><div class="info ">
A space with default color and styles<br>
</div>
<pre><span id="VALrender"><span class="keyword">val</span> render</span> : <code class="type"><a href="Lwt_term.html#TYPEpoint">point</a> array array -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
Render an offscreen array to the terminal.<br>
</div>
<pre><span id="VALrender_update"><span class="keyword">val</span> render_update</span> : <code class="type"><a href="Lwt_term.html#TYPEpoint">point</a> array array -> <a href="Lwt_term.html#TYPEpoint">point</a> array array -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info ">
<code class="code">render_update displayed to_display</code> does the same as <code class="code">render
to_display</code> but assumes that <code class="code">displayed</code> contains the current
displayed text. This reduces the amount of text sent to the
terminal.<br>
</div>
<br>
<h6 id="6_Drawing">Drawing</h6><br>
<pre><span class="keyword">module</span> <a href="Lwt_term.Zone.html">Zone</a>: <code class="code"><span class="keyword">sig</span></code> <a href="Lwt_term.Zone.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Off-screen zones
</div>
<pre><span class="keyword">module</span> <a href="Lwt_term.Draw.html">Draw</a>: <code class="code"><span class="keyword">sig</span></code> <a href="Lwt_term.Draw.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Drawing helpers
</div>
</body></html>
|