/usr/share/doc/liblambda-term-ocaml-dev/api/LTerm.html is in liblambda-term-ocaml-dev 1.9-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 | <!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="next" href="LTerm_key.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="LTerm" rel="Chapter" href="LTerm.html">
<link title="LTerm_key" rel="Chapter" href="LTerm_key.html">
<link title="LTerm_event" rel="Chapter" href="LTerm_event.html">
<link title="LTerm_unix" rel="Chapter" href="LTerm_unix.html">
<link title="LTerm_windows" rel="Chapter" href="LTerm_windows.html">
<link title="LTerm_style" rel="Chapter" href="LTerm_style.html">
<link title="LTerm_geom" rel="Chapter" href="LTerm_geom.html">
<link title="LTerm_draw" rel="Chapter" href="LTerm_draw.html">
<link title="LTerm_mouse" rel="Chapter" href="LTerm_mouse.html">
<link title="LTerm_widget" rel="Chapter" href="LTerm_widget.html">
<link title="LTerm_widget_callbacks" rel="Chapter" href="LTerm_widget_callbacks.html">
<link title="LTerm_edit" rel="Chapter" href="LTerm_edit.html">
<link title="LTerm_read_line" rel="Chapter" href="LTerm_read_line.html">
<link title="LTerm_text" rel="Chapter" href="LTerm_text.html">
<link title="LTerm_ui" rel="Chapter" href="LTerm_ui.html">
<link title="LTerm_resources" rel="Chapter" href="LTerm_resources.html">
<link title="LTerm_inputrc" rel="Chapter" href="LTerm_inputrc.html">
<link title="LTerm_history" rel="Chapter" href="LTerm_history.html"><link title="Creation" rel="Section" href="#6_Creation">
<link title="Informations" rel="Section" href="#6_Informations">
<link title="Modes" rel="Section" href="#6_Modes">
<link title="Cursor" rel="Section" href="#6_Cursor">
<link title="Erasing text" rel="Section" href="#6_Erasingtext">
<link title="State" rel="Section" href="#6_State">
<link title="Events" rel="Section" href="#6_Events">
<link title="Printing" rel="Section" href="#6_Printing">
<link title="Printing" rel="Section" href="#6_Printing">
<link title="Styles" rel="Section" href="#6_Styles">
<link title="Rendering" rel="Section" href="#6_Rendering">
<link title="Misc" rel="Section" href="#6_Misc">
<link title="Well known instances" rel="Section" href="#6_Wellknowninstances">
<link title="Low-level functions" rel="Section" href="#6_Lowlevelfunctions">
<link title="Modification" rel="Section" href="#6_Modification">
<link title="Printing contexts" rel="Subsection" href="#8_Printingcontexts">
<link title="Printing contexts" rel="Subsection" href="#8_Printingcontexts">
<title>LTerm</title>
</head>
<body>
<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a>
<a class="post" href="LTerm_key.html" title="LTerm_key">Next</a>
</div>
<h1>Module <a href="type_LTerm.html">LTerm</a></h1>
<pre><span class="keyword">module</span> LTerm: <code class="code">sig</code> <a href="LTerm.html">..</a> <code class="code">end</code></pre><div class="info module top">
Terminal definitions<br>
</div>
<hr width="100%">
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> </pre>
<div class="info ">
Type of terminals.<br>
</div>
<br>
<h6 id="6_Creation">Creation</h6><br>
<pre><span id="EXCEPTIONNo_such_encoding"><span class="keyword">exception</span> No_such_encoding</span> <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info ">
Exception raised when an encoding does not exist.<br>
</div>
<pre><span id="VALcreate"><span class="keyword">val</span> create</span> : <code class="type">?windows:bool -><br> ?model:string -><br> ?incoming_encoding:string -><br> ?outgoing_encoding:string -><br> Lwt_unix.file_descr -><br> Lwt_io.input_channel -><br> Lwt_unix.file_descr -> Lwt_io.output_channel -> <a href="LTerm.html#TYPEt">t</a> Lwt.t</code></pre><div class="info ">
<code class="code">create ?windows ?model ?incoming_encoding ?outgoing_encoding
input_fd input_channel outout_fd output_channel</code> creates a new
terminal using <code class="code">input_fd</code> and <code class="code">input_channel</code> for inputs and
<code class="code">output_fd</code> and <code class="code">output_channel</code> for outputs.
<p>
<ul>
<li><code class="code">windows</code> indicates whether the terminal is a windows console
(not mintty, rxvt, ...). It defaults to <code class="code">Sys.win32</code>.</li>
</ul>
<ul>
<li><code class="code">model</code> is the type of the terminal, such as "rxvt" or
"xterm". It defaults to the contents of the "TERM" environment
variable, or to "dumb" if this one is not found. It is used to
determine capabilities of the terminal, such as the number of
colors. This is not used if <code class="code">windows</code> is <code class="code">true</code>.</li>
</ul>
<ul>
<li><code class="code">incoming_encoding</code> is the encoding used for incoming data. It
defaults to <code class="code">LTerm_windows.get_console_cp</code> if <code class="code">windows</code> is <code class="code">true</code>
and <code class="code">LTerm_unix.system_encoding</code> otherwise.</li>
</ul>
<ul>
<li><code class="code">outgoing_encoding</code> is the encoding used for outgoing data. It
defaults to <code class="code">LTerm_windows.get_console_output_cp</code> if <code class="code">windows</code> is
<code class="code">true</code> and <code class="code">LTerm_unix.system_encoding</code> otherwise. Note that
transliteration is used so printing unicode character on the
terminal will never fail.</li>
</ul>
If one of the two given encodings does not exist, it raises
<code class="code">No_such_encoding</code>.
<p>
Note about terminal resize: in the windows console resizes are
not automatically detected. Lambda-term will only check for
resize only when something happens. If you want it to poll just
write somewhere in your program:
<p>
<pre class="codepre"><code class="code"> Lwt_engine.on_timer 1.0 true ignore
</code></pre><br>
</div>
<br>
<h6 id="6_Informations">Informations</h6><br>
<pre><span id="VALmodel"><span class="keyword">val</span> model</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> string</code></pre><div class="info ">
Returns the model of the terminal.<br>
</div>
<pre><span id="VALcolors"><span class="keyword">val</span> colors</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> int</code></pre><div class="info ">
Number of colors of the terminal.<br>
</div>
<pre><span id="VALwindows"><span class="keyword">val</span> windows</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
Whether the terminal is a windows console or not.<br>
</div>
<pre><span id="VALis_a_tty"><span class="keyword">val</span> is_a_tty</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
<code class="code">is_a_tty term</code> whether the intput and output of the given
terminal are connected to a tty device.<br>
</div>
<pre><span id="VALincoming_is_a_tty"><span class="keyword">val</span> incoming_is_a_tty</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
<code class="code">incoming_is_a_tty term</code> whether the input of <code class="code">term</code> is a tty
device.<br>
</div>
<pre><span id="VALoutgoing_is_a_tty"><span class="keyword">val</span> outgoing_is_a_tty</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
<code class="code">incoming_is_a_tty term</code> whether the output of <code class="code">term</code> is a tty
device.<br>
</div>
<pre><span id="VALescape_time"><span class="keyword">val</span> escape_time</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> float</code></pre><div class="info ">
Time waited before returning the escape key. This is not used on
windows.<br>
</div>
<pre><span id="VALset_escape_time"><span class="keyword">val</span> set_escape_time</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> float -> unit</code></pre><div class="info ">
Set the time waited before returning the escape key.<br>
</div>
<pre><span id="EXCEPTIONNot_a_tty"><span class="keyword">exception</span> Not_a_tty</span></pre>
<div class="info ">
Exception raised when trying to use a function that can only be
used on terminals.<br>
</div>
<pre><span id="VALsize"><span class="keyword">val</span> size</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm_geom.html#TYPEsize">LTerm_geom.size</a></code></pre><div class="info ">
Returns the curent size of the terminal.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the output of the given terminal is
not a tty.<br>
</div>
<br>
<h6 id="6_Modes">Modes</h6><br>
<pre><span id="TYPEmode"><span class="keyword">type</span> <code class="type"></code>mode</span> </pre>
<div class="info ">
Type of terminal modes.<br>
</div>
<pre><span id="VALenter_raw_mode"><span class="keyword">val</span> enter_raw_mode</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm.html#TYPEmode">mode</a> Lwt.t</code></pre><div class="info ">
<code class="code">enter_raw_mode term</code> puts the terminal in ``raw mode''. In this
mode keyboard events are returned as they happen. In normal mode
only complete line are returned. It returns the current terminal
mode that can be restored using <a href="LTerm.html#VALleave_raw_mode"><code class="code">LTerm.leave_raw_mode</code></a>.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the input of the given terminal is not
tty.<br>
</div>
<pre><span id="VALleave_raw_mode"><span class="keyword">val</span> leave_raw_mode</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm.html#TYPEmode">mode</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">leave_raw_mode term mode</code> leaves the raw mode by restoring the
given mode.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the input of the given terminal is not
tty.<br>
</div>
<pre><span id="VALenable_mouse"><span class="keyword">val</span> enable_mouse</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
Enable mouse events reporting.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the output of the given terminal is
not a tty.<br>
</div>
<pre><span id="VALdisable_mouse"><span class="keyword">val</span> disable_mouse</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
Disable mouse events reporting.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the output of the given terminal is
not a tty.<br>
</div>
<br>
<h6 id="6_Cursor">Cursor</h6><br>
<pre><span id="VALshow_cursor"><span class="keyword">val</span> show_cursor</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
Make the cursor visible.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the output of the given terminal is
not a tty.<br>
</div>
<pre><span id="VALhide_cursor"><span class="keyword">val</span> hide_cursor</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
Make the cursor invisible.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the output of the given terminal is
not a tty.<br>
</div>
<pre><span id="VALgoto"><span class="keyword">val</span> goto</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm_geom.html#TYPEcoord">LTerm_geom.coord</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">goto term coord</code> moves the cursor to the given coordinates.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the output of the given terminal is
not a tty.<br>
</div>
<pre><span id="VALmove"><span class="keyword">val</span> move</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> int -> int -> unit Lwt.t</code></pre><div class="info ">
<code class="code">move term rows columns</code> moves the cursor by the given number of
lines and columns. Both <code class="code">rows</code> and <code class="code">columns</code> may be negavite.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the output of the given terminal is
not a tty.<br>
</div>
<br>
<h6 id="6_Erasingtext">Erasing text</h6><br>
<pre><span id="VALclear_screen"><span class="keyword">val</span> clear_screen</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">clear_screen term</code> clears the entire screen.<br>
</div>
<pre><span id="VALclear_screen_next"><span class="keyword">val</span> clear_screen_next</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">clear_screen_next term</code> clears the screen from the cursor to
the bottom of the screen.<br>
</div>
<pre><span id="VALclear_screen_prev"><span class="keyword">val</span> clear_screen_prev</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">clear_screen_prev term</code> clears the screen from the cursor to
the top of the screen.<br>
</div>
<pre><span id="VALclear_line"><span class="keyword">val</span> clear_line</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">clear_line term</code> erases the current line.<br>
</div>
<pre><span id="VALclear_line_next"><span class="keyword">val</span> clear_line_next</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">clear_line_next term</code> erases the current line from the cursor
to the end of the line.<br>
</div>
<pre><span id="VALclear_line_prev"><span class="keyword">val</span> clear_line_prev</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">clear_line_prev term</code> erases the current line from the cursor
to the beginning of the line.<br>
</div>
<br>
<h6 id="6_State">State</h6><br>
<pre><span id="VALsave_state"><span class="keyword">val</span> save_state</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
Save the current state of the terminal so it can be restored
latter.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the output of the given terminal is
not a tty.<br>
</div>
<pre><span id="VALload_state"><span class="keyword">val</span> load_state</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
Load the previously saved state of the terminal.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the output of the given terminal is
not a tty.<br>
</div>
<br>
<h6 id="6_Events">Events</h6><br>
<pre><span id="VALread_event"><span class="keyword">val</span> read_event</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm_event.html#TYPEt">LTerm_event.t</a> Lwt.t</code></pre><div class="info ">
Reads and returns one event. The terminal should be in raw mode
before calling this function, otherwise event will not be
reported as they happen. It does not fail if the terminal is not
a tty.
<p>
Note: you must not call <a href="LTerm.html#VALread_event"><code class="code">LTerm.read_event</code></a> from multiple thread at
the same time, it will raise <code class="code">Failure</code> if you try to do so.<br>
</div>
<br>
<h6 id="6_Printing">Printing</h6><br>
<br>
<h6 id="6_Printing">Printing</h6><br>
<br>
All these functions accept only valid UTF-8 strings (or unicode
styled text). Strings are recoded on the fly using the terminal
output encoding (except if the terminal output encoding is already
UTF-8, in which case the string is just printed as-it).
<p>
The general name of a printing function is <code class="code"><prefix>print<suffixes></code>.
<p>
Where <code class="code"><prefix></code> is one of:<ul>
<li><code class="code">'f'</code>, which means that the function takes as argument a terminal</li>
<li>nothing, which means that the function prints on <a href="LTerm.html#VALstdout"><code class="code">LTerm.stdout</code></a></li>
<li><code class="code">'e'</code>, which means that the function prints on <a href="LTerm.html#VALstderr"><code class="code">LTerm.stderr</code></a></li>
</ul>
and <code class="code"><suffixes></code> is a combination of:<ul>
<li><code class="code">'l'</code> which means that a new-line character is printed after the message</li>
<li><code class="code">'f'</code> which means that the function takes as argument a <b>format</b> instead
of a string</li>
<li><code class="code">'s'</code> which means that the function takes as argument a styled
string instead of a string</li>
</ul>
Note that if the terminal is not a tty, styles are stripped.<br>
<pre><span id="VALfprint"><span class="keyword">val</span> fprint</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> Zed_utf8.t -> unit Lwt.t</code></pre>
<pre><span id="VALfprintl"><span class="keyword">val</span> fprintl</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> Zed_utf8.t -> unit Lwt.t</code></pre>
<pre><span id="VALfprintf"><span class="keyword">val</span> fprintf</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> ('a, unit, Zed_utf8.t, unit Lwt.t) Pervasives.format4 -> 'a</code></pre>
<pre><span id="VALfprints"><span class="keyword">val</span> fprints</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm_text.html#TYPEt">LTerm_text.t</a> -> unit Lwt.t</code></pre>
<pre><span id="VALfprintlf"><span class="keyword">val</span> fprintlf</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> ('a, unit, Zed_utf8.t, unit Lwt.t) Pervasives.format4 -> 'a</code></pre>
<pre><span id="VALfprintls"><span class="keyword">val</span> fprintls</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm_text.html#TYPEt">LTerm_text.t</a> -> unit Lwt.t</code></pre>
<pre><span id="VALprint"><span class="keyword">val</span> print</span> : <code class="type">Zed_utf8.t -> unit Lwt.t</code></pre>
<pre><span id="VALprintl"><span class="keyword">val</span> printl</span> : <code class="type">Zed_utf8.t -> unit Lwt.t</code></pre>
<pre><span id="VALprintf"><span class="keyword">val</span> printf</span> : <code class="type">('a, unit, Zed_utf8.t, unit Lwt.t) Pervasives.format4 -> 'a</code></pre>
<pre><span id="VALprints"><span class="keyword">val</span> prints</span> : <code class="type"><a href="LTerm_text.html#TYPEt">LTerm_text.t</a> -> unit Lwt.t</code></pre>
<pre><span id="VALprintlf"><span class="keyword">val</span> printlf</span> : <code class="type">('a, unit, Zed_utf8.t, unit Lwt.t) Pervasives.format4 -> 'a</code></pre>
<pre><span id="VALprintls"><span class="keyword">val</span> printls</span> : <code class="type"><a href="LTerm_text.html#TYPEt">LTerm_text.t</a> -> unit Lwt.t</code></pre>
<pre><span id="VALeprint"><span class="keyword">val</span> eprint</span> : <code class="type">Zed_utf8.t -> unit Lwt.t</code></pre>
<pre><span id="VALeprintl"><span class="keyword">val</span> eprintl</span> : <code class="type">Zed_utf8.t -> unit Lwt.t</code></pre>
<pre><span id="VALeprintf"><span class="keyword">val</span> eprintf</span> : <code class="type">('a, unit, Zed_utf8.t, unit Lwt.t) Pervasives.format4 -> 'a</code></pre>
<pre><span id="VALeprints"><span class="keyword">val</span> eprints</span> : <code class="type"><a href="LTerm_text.html#TYPEt">LTerm_text.t</a> -> unit Lwt.t</code></pre>
<pre><span id="VALeprintlf"><span class="keyword">val</span> eprintlf</span> : <code class="type">('a, unit, Zed_utf8.t, unit Lwt.t) Pervasives.format4 -> 'a</code></pre>
<pre><span id="VALeprintls"><span class="keyword">val</span> eprintls</span> : <code class="type"><a href="LTerm_text.html#TYPEt">LTerm_text.t</a> -> unit Lwt.t</code></pre><br>
<div class="h8" id="8_Printingcontexts">Printing contexts</div><br>
<br>
<div class="h8" id="8_Printingcontexts">Printing contexts</div><br>
<br>
You shoud use these functions when you to print a lot of styled
text that does not entirely fit in a single <a href="LTerm_text.html#TYPEt"><code class="code">LTerm_text.t</code></a>
value.
<p>
This is more efficient than calling manually <a href="LTerm.html#VALset_style"><code class="code">LTerm.set_style</code></a> since
styles will be modified only when needed.<br>
<pre><span id="TYPEcontext"><span class="keyword">type</span> <code class="type"></code>context</span> </pre>
<div class="info ">
A context for styled printing.<br>
</div>
<pre><span id="VALwith_context"><span class="keyword">val</span> with_context</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> (<a href="LTerm.html#TYPEcontext">context</a> -> 'a Lwt.t) -> 'a Lwt.t</code></pre><div class="info ">
<code class="code">with_context term f</code> creates a new printing context and pass it
to <code class="code">f</code>. Note that calls to <code class="code">with_context</code> are serialized.<br>
</div>
<pre><span id="VALupdate_style"><span class="keyword">val</span> update_style</span> : <code class="type"><a href="LTerm.html#TYPEcontext">context</a> -> <a href="LTerm_style.html#TYPEt">LTerm_style.t</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">update_style ctx style</code> updates the style of the context with
<code class="code">style</code>. If needed styles of the terminal are modified.<br>
</div>
<pre><span id="VALcontext_term"><span class="keyword">val</span> context_term</span> : <code class="type"><a href="LTerm.html#TYPEcontext">context</a> -> <a href="LTerm.html#TYPEt">t</a></code></pre><div class="info ">
Returns the terminal used by the given context.<br>
</div>
<pre><span id="VALcontext_oc"><span class="keyword">val</span> context_oc</span> : <code class="type"><a href="LTerm.html#TYPEcontext">context</a> -> Lwt_io.output_channel</code></pre><div class="info ">
Returns the output channel used by the given context. Note that
this channel cannot be used after <a href="LTerm.html#VALwith_context"><code class="code">LTerm.with_context</code></a> has
terminated.<br>
</div>
<pre><span id="VALencode_string"><span class="keyword">val</span> encode_string</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> Zed_utf8.t -> string</code></pre><div class="info ">
<code class="code">encode_string term str</code> encodes an UTF-8 string using the
terminal encoding.<br>
</div>
<pre><span id="VALencode_char"><span class="keyword">val</span> encode_char</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> CamomileLibrary.UChar.t -> string</code></pre><div class="info ">
<code class="code">encode_char term ch</code> encodes an unicode character using the
terminal encoding.<br>
</div>
<br>
<h6 id="6_Styles">Styles</h6><br>
<pre><span id="VALset_style"><span class="keyword">val</span> set_style</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm_style.html#TYPEt">LTerm_style.t</a> -> unit Lwt.t</code></pre><div class="info ">
Change the style of the termina for subsequent unstyled
output. It does nothing if the output is not a tty.<br>
</div>
<br>
<h6 id="6_Rendering">Rendering</h6><br>
<pre><span id="VALrender"><span class="keyword">val</span> render</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm_draw.html#TYPEmatrix">LTerm_draw.matrix</a> -> unit Lwt.t</code></pre><div class="info ">
Render an offscreen array to the given terminal.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the output of the given terminal is
not a tty.<br>
</div>
<pre><span id="VALrender_update"><span class="keyword">val</span> render_update</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm_draw.html#TYPEmatrix">LTerm_draw.matrix</a> -> <a href="LTerm_draw.html#TYPEmatrix">LTerm_draw.matrix</a> -> unit Lwt.t</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.
<p>
It raises <a href="LTerm.html#EXCEPTIONNot_a_tty"><code class="code">LTerm.Not_a_tty</code></a> if the output of the given terminal is
not a tty.<br>
</div>
<pre><span id="VALprint_box"><span class="keyword">val</span> print_box</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm_draw.html#TYPEmatrix">LTerm_draw.matrix</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">print_box term matrix</code> prints the contents of <code class="code">matrix</code> starting
at current cursor row. Note that when you have the choice
between using <a href="LTerm.html#VALfprints"><code class="code">LTerm.fprints</code></a> and <a href="LTerm.html#VALprint_box"><code class="code">LTerm.print_box</code></a> you should use
<a href="LTerm.html#VALprint_box"><code class="code">LTerm.print_box</code></a> because it works better under windows and is more
efficient.
<p>
The cursor is moved to the beginning of the last displayed
line.<br>
</div>
<pre><span id="VALprint_box_with_newlines"><span class="keyword">val</span> print_box_with_newlines</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> <a href="LTerm_draw.html#TYPEmatrix">LTerm_draw.matrix</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">print_box term matrix</code> Same as <a href="LTerm.html#VALprint_box"><code class="code">LTerm.print_box</code></a> but <code class="code">matrix</code>
may contains newline characters. It must contain one more column
that the terminal (in case a line of the length of the terminal
ends with a newline).
<p>
The difference between <a href="LTerm.html#VALprint_box"><code class="code">LTerm.print_box</code></a> and
<a href="LTerm.html#VALprint_box_with_newlines"><code class="code">LTerm.print_box_with_newlines</code></a> is that when the text is selected in
the terminal, with <a href="LTerm.html#VALprint_box"><code class="code">LTerm.print_box</code></a> it will always be a box with the
dimensions of <code class="code">matrix</code>. With <a href="LTerm.html#VALprint_box_with_newlines"><code class="code">LTerm.print_box_with_newlines</code></a> it may
contains lines longer than the width of the terminal.
<p>
The contents of a line after the first newline character (if
any) in a row of <code class="code">matrix</code> is ignored. The rest of the line get
the style of the newline character.<br>
</div>
<br>
<h6 id="6_Misc">Misc</h6><br>
<pre><span id="VALflush"><span class="keyword">val</span> flush</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
Flushes the underlying output channel used by the terminal.<br>
</div>
<br>
<h6 id="6_Wellknowninstances">Well known instances</h6><br>
<pre><span id="VALstdout"><span class="keyword">val</span> stdout</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> Lwt.t Lazy.t</code></pre><div class="info ">
Terminal using <code class="code">Lwt_unix.stdin</code> as input and <code class="code">Lwt_unix.stdout</code>
as output.<br>
</div>
<pre><span id="VALstderr"><span class="keyword">val</span> stderr</span> : <code class="type"><a href="LTerm.html#TYPEt">t</a> Lwt.t Lazy.t</code></pre><div class="info ">
Terminal using <code class="code">Lwt_unix.stdin</code> as input and <code class="code">Lwt_unix.stderr</code>
as output.<br>
</div>
<br>
<h6 id="6_Lowlevelfunctions">Low-level functions</h6><br>
<pre><span id="VALget_size_from_fd"><span class="keyword">val</span> get_size_from_fd</span> : <code class="type">Lwt_unix.file_descr -> <a href="LTerm_geom.html#TYPEsize">LTerm_geom.size</a> Lwt.t</code></pre><div class="info ">
<code class="code">get_size_from_fd fd</code> returns the size of the terminal accessible via
the given file descriptor.<br>
</div>
<pre><span id="VALset_size_from_fd"><span class="keyword">val</span> set_size_from_fd</span> : <code class="type">Lwt_unix.file_descr -> <a href="LTerm_geom.html#TYPEsize">LTerm_geom.size</a> -> unit Lwt.t</code></pre><div class="info ">
<code class="code">set_size_from_fd fd size</code> tries to set the size of the terminal
accessible via the given file descriptor.<br>
</div>
<br>
<h6 id="6_Modification">Modification</h6><br>
<pre><span id="VALset_io"><span class="keyword">val</span> set_io</span> : <code class="type">?incoming_fd:Lwt_unix.file_descr -><br> ?incoming_channel:Lwt_io.input_channel -><br> ?outgoing_fd:Lwt_unix.file_descr -><br> ?outgoing_channel:Lwt_io.output_channel -> <a href="LTerm.html#TYPEt">t</a> -> unit Lwt.t</code></pre><div class="info ">
Modifies file descriptors/channels of a terminal. Unspecified
arguments are kept unchanged.
<p>
Note: before modifying a terminal you should ensure that no
operation is pending on it.<br>
</div>
</body></html>
|