assets/minline/minline.html
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 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 |
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- This file is generated by Nim. --> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Favicon --> <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/> <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII="> <!-- Google fonts --> <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/> <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/> <!-- CSS --> <title>minline</title> <link rel="stylesheet" type="text/css" href="nimdoc.out.css"> <script type="text/javascript" src="dochack.js"></script> <script type="text/javascript"> function main() { var pragmaDots = document.getElementsByClassName("pragmadots"); for (var i = 0; i < pragmaDots.length; i++) { pragmaDots[i].onclick = function(event) { // Hide tease event.target.parentNode.style.display = "none"; // Show actual event.target.parentNode.nextElementSibling.style.display = "inline"; } } function switchTheme(e) { if (e.target.checked) { document.documentElement.setAttribute('data-theme', 'dark'); localStorage.setItem('theme', 'dark'); } else { document.documentElement.setAttribute('data-theme', 'light'); localStorage.setItem('theme', 'light'); } } const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]'); if (toggleSwitch !== null) { toggleSwitch.addEventListener('change', switchTheme, false); } var currentTheme = localStorage.getItem('theme'); if (!currentTheme && window.matchMedia('(prefers-color-scheme: dark)').matches) { currentTheme = 'dark'; } if (currentTheme) { document.documentElement.setAttribute('data-theme', currentTheme); if (currentTheme === 'dark' && toggleSwitch !== null) { toggleSwitch.checked = true; } } } window.addEventListener('DOMContentLoaded', main); </script> </head> <body> <div class="document" id="documentId"> <div class="container"> <h1 class="title">minline</h1> <div class="row"> <div class="three columns"> <div class="theme-switch-wrapper"> <label class="theme-switch" for="checkbox"> <input type="checkbox" id="checkbox" /> <div class="slider round"></div> </label> <em>Dark Mode</em> </div> <div id="global-links"> <ul class="simple"> <li> <a href="theindex.html">Index</a> </li> </ul> </div> <div id="searchInputDiv"> Search: <input type="text" id="searchInput" onkeyup="search()" /> </div> <div> Group by: <select onchange="groupBy(this.value)"> <option value="section">Section</option> <option value="type">Type</option> </select> </div> <ul class="simple simple-toc" id="toc-list"> <li> <a class="reference reference-toplevel" href="#7" id="57">Types</a> <ul class="simple simple-toc-section"> <li><a class="reference" href="#Key" title="Key = int">Key</a></li> <li><a class="reference" href="#KeyCallback" title="KeyCallback = proc (ed: var LineEditor) {.closure, gcsafe.}">KeyCallback</a></li> <li><a class="reference" href="#KeySeq" title="KeySeq = seq[Key]">KeySeq</a></li> <li><a class="reference" href="#Line" title="Line = object text: string position: int">Line</a></li> <li><a class="reference" href="#LineEditor" title="LineEditor = object completionCallback*: proc (ed: LineEditor): seq[string] {.closure, gcsafe.} history: LineHistory line: Line mode: LineEditorMode">LineEditor</a></li> <li><a class="reference" href="#LineEditorError" title="LineEditorError = ref Exception">LineEditorError</a></li> <li><a class="reference" href="#LineEditorMode" title="LineEditorMode = enum mdInsert, mdReplace">LineEditorMode</a></li> <li><a class="reference" href="#LineError" title="LineError = ref Exception">LineError</a></li> <li><a class="reference" href="#LineHistory" title="LineHistory = object file: string tainted: bool position: int queue: Deque[string] max: int">LineHistory</a></li> </ul> </li> <li> <a class="reference reference-toplevel" href="#8" id="58">Vars</a> <ul class="simple simple-toc-section"> <li><a class="reference" href="#KEYMAP" title="KEYMAP: CritBitTree[KeyCallback]">KEYMAP</a></li> <li><a class="reference" href="#KEYNAMES" title="KEYNAMES: array[0 .. 31, string]">KEYNAMES</a></li> <li><a class="reference" href="#KEYSEQS" title="KEYSEQS: CritBitTree[KeySeq]">KEYSEQS</a></li> </ul> </li> <li> <a class="reference reference-toplevel" href="#10" id="60">Consts</a> <ul class="simple simple-toc-section"> <li><a class="reference" href="#CTRL" title="CTRL = {0..31}">CTRL</a></li> <li><a class="reference" href="#DIGIT" title="DIGIT = {48..57}">DIGIT</a></li> <li><a class="reference" href="#ESCAPES" title="ESCAPES = {27}">ESCAPES</a></li> <li><a class="reference" href="#LETTER" title="LETTER = {65..122}">LETTER</a></li> <li><a class="reference" href="#LOWERLETTER" title="LOWERLETTER = {97..122}">LOWERLETTER</a></li> <li><a class="reference" href="#PRINTABLE" title="PRINTABLE = {32..126}">PRINTABLE</a></li> <li><a class="reference" href="#UPPERLETTER" title="UPPERLETTER = {65..90}">UPPERLETTER</a></li> </ul> </li> <li> <a class="reference reference-toplevel" href="#12" id="62">Procs</a> <ul class="simple simple-toc-section"> <ul class="simple nested-toc-section">back <li><a class="reference" href="#back%2CLineEditor%2Cint" title="back(ed: var LineEditor; n = 1)">back(ed: var LineEditor; n = 1)</a></li> </ul> <ul class="simple nested-toc-section">changeLine <li><a class="reference" href="#changeLine%2CLineEditor%2Cstring" title="changeLine(ed: var LineEditor; s: string)">changeLine(ed: var LineEditor; s: string)</a></li> </ul> <ul class="simple nested-toc-section">clearLine <li><a class="reference" href="#clearLine%2CLineEditor" title="clearLine(ed: var LineEditor)">clearLine(ed: var LineEditor)</a></li> </ul> <ul class="simple nested-toc-section">completeLine <li><a class="reference" href="#completeLine%2CLineEditor" title="completeLine(ed: var LineEditor): int">completeLine(ed: var LineEditor): int</a></li> </ul> <ul class="simple nested-toc-section">deleteNext <li><a class="reference" href="#deleteNext%2CLineEditor" title="deleteNext(ed: var LineEditor)">deleteNext(ed: var LineEditor)</a></li> </ul> <ul class="simple nested-toc-section">deletePrevious <li><a class="reference" href="#deletePrevious%2CLineEditor" title="deletePrevious(ed: var LineEditor)">deletePrevious(ed: var LineEditor)</a></li> </ul> <ul class="simple nested-toc-section">forward <li><a class="reference" href="#forward%2CLineEditor%2Cint" title="forward(ed: var LineEditor; n = 1)">forward(ed: var LineEditor; n = 1)</a></li> </ul> <ul class="simple nested-toc-section">getchr <li><a class="reference" href="#getchr" title="getchr(): cint">getchr(): cint</a></li> </ul> <ul class="simple nested-toc-section">goToEnd <li><a class="reference" href="#goToEnd%2CLineEditor" title="goToEnd(ed: var LineEditor)">goToEnd(ed: var LineEditor)</a></li> </ul> <ul class="simple nested-toc-section">goToStart <li><a class="reference" href="#goToStart%2CLineEditor" title="goToStart(ed: var LineEditor)">goToStart(ed: var LineEditor)</a></li> </ul> <ul class="simple nested-toc-section">historyAdd <li><a class="reference" href="#historyAdd%2CLineEditor" title="historyAdd(ed: var LineEditor; force = false)">historyAdd(ed: var LineEditor; force = false)</a></li> </ul> <ul class="simple nested-toc-section">historyFlush <li><a class="reference" href="#historyFlush%2CLineEditor" title="historyFlush(ed: var LineEditor)">historyFlush(ed: var LineEditor)</a></li> </ul> <ul class="simple nested-toc-section">historyInit <li><a class="reference" href="#historyInit%2Cint%2Cstring" title="historyInit(size = 256; file: string = ""): LineHistory">historyInit(size = 256; file: string = ""): LineHistory</a></li> </ul> <ul class="simple nested-toc-section">historyNext <li><a class="reference" href="#historyNext%2CLineEditor" title="historyNext(ed: var LineEditor)">historyNext(ed: var LineEditor)</a></li> </ul> <ul class="simple nested-toc-section">historyPrevious <li><a class="reference" href="#historyPrevious%2CLineEditor" title="historyPrevious(ed: var LineEditor)">historyPrevious(ed: var LineEditor)</a></li> </ul> <ul class="simple nested-toc-section">initEditor <li><a class="reference" href="#initEditor%2Cint%2Cstring" title="initEditor(mode = mdInsert; historySize = 256; historyFile: string = ""): LineEditor">initEditor(mode = mdInsert; historySize = 256; historyFile: string = ""): LineEditor</a></li> </ul> <ul class="simple nested-toc-section">lineText <li><a class="reference" href="#lineText%2CLineEditor" title="lineText(ed: LineEditor): string">lineText(ed: LineEditor): string</a></li> </ul> <ul class="simple nested-toc-section">password <li><a class="reference" href="#password%2CLineEditor%2Cstring" title="password(ed: var LineEditor; prompt = ""): string">password(ed: var LineEditor; prompt = ""): string</a></li> </ul> <ul class="simple nested-toc-section">printChar <li><a class="reference" href="#printChar%2CLineEditor%2Cint" title="printChar(ed: var LineEditor; c: int)">printChar(ed: var LineEditor; c: int)</a></li> </ul> <ul class="simple nested-toc-section">putchr <li><a class="reference" href="#putchr%2Ccint" title="putchr(c: cint)">putchr(c: cint)</a></li> </ul> <ul class="simple nested-toc-section">readLine <li><a class="reference" href="#readLine%2CLineEditor%2Cstring" title="readLine(ed: var LineEditor; prompt = ""; hidechars = false): string">readLine(ed: var LineEditor; prompt = ""; hidechars = false): string</a></li> </ul> </ul> </li> </ul> </div> <div class="nine columns" id="content"> <div id="tocRoot"></div> <p class="module-desc"><p>This module provides a simple, limited but fully-functional line editing library written in pure Nim.</p> <p>To use this library, you must first initialize a <strong>LineEditor</strong> object using the <strong>initEditor</strong> method, and then use the <strong>readLine</strong> method to capture standard input instead of <strong>stdout.readLine</strong>:</p> <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">ed</span> <span class="Operator">=</span> <span class="Identifier">initEditor</span><span class="Punctuation">(</span><span class="Identifier">historyFile</span> <span class="Operator">=</span> <span class="StringLit">"history.txt"</span><span class="Punctuation">)</span> <span class="Keyword">while</span> <span class="Identifier">true</span><span class="Punctuation">:</span> <span class="Keyword">let</span> <span class="Identifier">str</span> <span class="Operator">=</span> <span class="Identifier">ed</span><span class="Operator">.</span><span class="Identifier">readLine</span><span class="Punctuation">(</span><span class="StringLit">"-> "</span><span class="Punctuation">)</span> <span class="Identifier">echo</span> <span class="StringLit">"You typed: "</span><span class="Punctuation">,</span> <span class="Identifier">str</span></pre><p>Optionally, you can also configure custom key bindings for keys and key sequences:</p> <pre class="listing"><span class="Identifier">KEYMAP</span><span class="Punctuation">[</span><span class="StringLit">"ctrl+k"</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Keyword">proc</span><span class="Punctuation">(</span><span class="Identifier">ed</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">LineEditor</span><span class="Punctuation">)</span> <span class="Operator">=</span> <span class="Identifier">ed</span><span class="Operator">.</span><span class="Identifier">clearLine</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre><p>Additionally, you can also configure a <strong>completionCallback</strong> proc to trigger auto-completion by pressing TAB:</p> <pre class="listing"><span class="Identifier">ed</span><span class="Operator">.</span><span class="Identifier">completionCallback</span> <span class="Operator">=</span> <span class="Keyword">proc</span><span class="Punctuation">(</span><span class="Identifier">ed</span><span class="Punctuation">:</span> <span class="Identifier">LineEditor</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Keyword">return</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">"copy"</span><span class="Punctuation">,</span> <span class="StringLit">"list"</span><span class="Punctuation">,</span> <span class="StringLit">"delete"</span><span class="Punctuation">,</span> <span class="StringLit">"move"</span><span class="Punctuation">,</span> <span class="StringLit">"remove"</span><span class="Punctuation">]</span></pre><p><strong>Note</strong> When compared to the readline or linenoise libraries, this module has the following limitations:</p> <ul class="simple"><li>It is only possible to edit one line of text at a time. When using the <strong>readLine</strong> method, it will not be possible to physically go to the next line (this simplifies things a bit...).</li> <li>No UTF8 support, only ASCII characters are supported.</li> <li>No support for colorized output.</li> <li>Only limited support for Emacs keybindings, no support for Vi mode and Vi keybindings.</li> </ul> </p> <div class="section" id="7"> <h1><a class="toc-backref" href="#7">Types</a></h1> <dl class="item"> <div id="Key"> <dt><pre><a href="minline.html#Key"><span class="Identifier">Key</span></a> <span class="Other">=</span> <span class="Identifier">int</span></pre></dt> <dd> The ASCII code of a keyboard key. </dd> </div> <div id="KeyCallback"> <dt><pre><a href="minline.html#KeyCallback"><span class="Identifier">KeyCallback</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}</pre></dt> <dd> A proc that can be bound to a key or a key sequence to access line editing functionalities. </dd> </div> <div id="KeySeq"> <dt><pre><a href="minline.html#KeySeq"><span class="Identifier">KeySeq</span></a> <span class="Other">=</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="minline.html#Key"><span class="Identifier">Key</span></a><span class="Other">]</span></pre></dt> <dd> A sequence of one or more Keys. </dd> </div> <div id="Line"> <dt><pre><a href="minline.html#Line"><span class="Identifier">Line</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Identifier">text</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Identifier">position</span><span class="Other">:</span> <span class="Identifier">int</span> </pre></dt> <dd> An object representing a line of text. </dd> </div> <div id="LineEditor"> <dt><pre><a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Identifier">completionCallback</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.} <span class="Identifier">history</span><span class="Other">:</span> <a href="minline.html#LineHistory"><span class="Identifier">LineHistory</span></a> <span class="Identifier">line</span><span class="Other">:</span> <a href="minline.html#Line"><span class="Identifier">Line</span></a> <span class="Identifier">mode</span><span class="Other">:</span> <a href="minline.html#LineEditorMode"><span class="Identifier">LineEditorMode</span></a> </pre></dt> <dd> An object representing a line editor, used to process text typed in the terminal. </dd> </div> <div id="LineEditorError"> <dt><pre><a href="minline.html#LineEditorError"><span class="Identifier">LineEditorError</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Identifier">Exception</span></pre></dt> <dd> An error occured in the LineEditor. </dd> </div> <div id="LineEditorMode"> <dt><pre><a href="minline.html#LineEditorMode"><span class="Identifier">LineEditorMode</span></a> <span class="Other">=</span> <span class="Keyword">enum</span> <span class="Identifier">mdInsert</span><span class="Other">,</span> <span class="Identifier">mdReplace</span></pre></dt> <dd> The <em>mode</em> a LineEditor operates in (insert or replace). </dd> </div> <div id="LineError"> <dt><pre><a href="minline.html#LineError"><span class="Identifier">LineError</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Identifier">Exception</span></pre></dt> <dd> A generic minline error. </dd> </div> <div id="LineHistory"> <dt><pre><a href="minline.html#LineHistory"><span class="Identifier">LineHistory</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Identifier">file</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Identifier">tainted</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Identifier">position</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Identifier">queue</span><span class="Other">:</span> <span class="Identifier">Deque</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Identifier">max</span><span class="Other">:</span> <span class="Identifier">int</span> </pre></dt> <dd> An object representing the history of all commands typed in a LineEditor. </dd> </div> </dl></div> <div class="section" id="8"> <h1><a class="toc-backref" href="#8">Vars</a></h1> <dl class="item"> <div id="KEYMAP"> <dt><pre><a href="minline.html#KEYMAP"><span class="Identifier">KEYMAP</span></a><span class="Other">:</span> <span class="Identifier">CritBitTree</span><span class="Other">[</span><a href="minline.html#KeyCallback"><span class="Identifier">KeyCallback</span></a><span class="Other">]</span></pre></dt> <dd> The following key mappings are configured by default:<ul class="simple"><li>backspace: <strong>deletePrevious</strong></li> <li>delete: <strong>deleteNext</strong></li> <li>insert: <em>toggle editor mode</em></li> <li>down: <strong>historyNext</strong></li> <li>up: <strong>historyPrevious</strong></li> <li>ctrl+n: <strong>historyNext</strong></li> <li>ctrl+p: <strong>historyPrevious</strong></li> <li>left: <strong>back</strong></li> <li>right: <strong>forward</strong></li> <li>ctrl+b: <strong>back</strong></li> <li>ctrl+f: <strong>forward</strong></li> <li>ctrl+c: <em>quits the program</em></li> <li>ctrl+d: <em>quits the program</em></li> <li>ctrl+u: <strong>clearLine</strong></li> <li>ctrl+a: <strong>goToStart</strong></li> <li>ctrl+e: <strong>goToEnd</strong></li> <li>home: <strong>goToStart</strong></li> <li>end: <strong>goToEnd</strong></li> </ul> </dd> </div> <div id="KEYNAMES"> <dt><pre><a href="minline.html#KEYNAMES"><span class="Identifier">KEYNAMES</span></a><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="DecNumber">0</span> <span class="Operator">..</span> <span class="DecNumber">31</span><span class="Other">,</span> <span class="Identifier">string</span><span class="Other">]</span></pre></dt> <dd> The following strings can be used in keymaps instead of the correspinding ASCII codes:<pre class="listing"><span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+a"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+b"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+c"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">4</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+d"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+e"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">6</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+f"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">7</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+g"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">8</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+h"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">9</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+i"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">9</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"tab"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">10</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+j"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">11</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+k"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">12</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+l"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">13</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+m"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">14</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+n"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">15</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+o"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">16</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+p"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">17</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+q"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">18</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+r"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">19</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+s"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">20</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+t"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">21</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+u"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">22</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+v"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">23</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+w"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">24</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+x"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">25</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+y"</span> <span class="Identifier">KEYNAMES</span><span class="Punctuation">[</span><span class="DecNumber">26</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">"ctrl+z"</span></pre> </dd> </div> <div id="KEYSEQS"> <dt><pre><a href="minline.html#KEYSEQS"><span class="Identifier">KEYSEQS</span></a><span class="Other">:</span> <span class="Identifier">CritBitTree</span><span class="Other">[</span><a href="minline.html#KeySeq"><span class="Identifier">KeySeq</span></a><span class="Other">]</span></pre></dt> <dd> The following key sequences are defined and are used internally by <strong>LineEditor</strong>:<pre class="listing"><span class="Identifier">KEYSEQS</span><span class="Punctuation">[</span><span class="StringLit">"up"</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">27</span><span class="Punctuation">,</span> <span class="DecNumber">91</span><span class="Punctuation">,</span> <span class="DecNumber">65</span><span class="Punctuation">]</span> <span class="Comment"># Windows: @[224, 72]</span> <span class="Identifier">KEYSEQS</span><span class="Punctuation">[</span><span class="StringLit">"down"</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">27</span><span class="Punctuation">,</span> <span class="DecNumber">91</span><span class="Punctuation">,</span> <span class="DecNumber">66</span><span class="Punctuation">]</span> <span class="Comment"># Windows: @[224, 80]</span> <span class="Identifier">KEYSEQS</span><span class="Punctuation">[</span><span class="StringLit">"right"</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">27</span><span class="Punctuation">,</span> <span class="DecNumber">91</span><span class="Punctuation">,</span> <span class="DecNumber">67</span><span class="Punctuation">]</span> <span class="Comment"># Windows: @[224, 77]</span> <span class="Identifier">KEYSEQS</span><span class="Punctuation">[</span><span class="StringLit">"left"</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">27</span><span class="Punctuation">,</span> <span class="DecNumber">91</span><span class="Punctuation">,</span> <span class="DecNumber">68</span><span class="Punctuation">]</span> <span class="Comment"># Windows: @[224, 75]</span> <span class="Identifier">KEYSEQS</span><span class="Punctuation">[</span><span class="StringLit">"home"</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">27</span><span class="Punctuation">,</span> <span class="DecNumber">91</span><span class="Punctuation">,</span> <span class="DecNumber">72</span><span class="Punctuation">]</span> <span class="Comment"># Windows: @[224, 71]</span> <span class="Identifier">KEYSEQS</span><span class="Punctuation">[</span><span class="StringLit">"end"</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">27</span><span class="Punctuation">,</span> <span class="DecNumber">91</span><span class="Punctuation">,</span> <span class="DecNumber">70</span><span class="Punctuation">]</span> <span class="Comment"># Windows: @[224, 79]</span> <span class="Identifier">KEYSEQS</span><span class="Punctuation">[</span><span class="StringLit">"insert"</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">27</span><span class="Punctuation">,</span> <span class="DecNumber">91</span><span class="Punctuation">,</span> <span class="DecNumber">50</span><span class="Punctuation">,</span> <span class="DecNumber">126</span><span class="Punctuation">]</span> <span class="Comment"># Windows: @[224, 82]</span> <span class="Identifier">KEYSEQS</span><span class="Punctuation">[</span><span class="StringLit">"delete"</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">27</span><span class="Punctuation">,</span> <span class="DecNumber">91</span><span class="Punctuation">,</span> <span class="DecNumber">51</span><span class="Punctuation">,</span> <span class="DecNumber">126</span><span class="Punctuation">]</span> <span class="Comment"># Windows: @[224, 83]</span></pre> </dd> </div> </dl></div> <div class="section" id="10"> <h1><a class="toc-backref" href="#10">Consts</a></h1> <dl class="item"> <div id="CTRL"> <dt><pre><a href="minline.html#CTRL"><span class="Identifier">CTRL</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">0</span><span class="Other">..</span><span class="DecNumber">31</span><span class="Other">}</span></pre></dt> <dd> Control characters. </dd> </div> <div id="DIGIT"> <dt><pre><a href="minline.html#DIGIT"><span class="Identifier">DIGIT</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">48</span><span class="Other">..</span><span class="DecNumber">57</span><span class="Other">}</span></pre></dt> <dd> Digits. </dd> </div> <div id="ESCAPES"> <dt><pre><a href="minline.html#ESCAPES"><span class="Identifier">ESCAPES</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">27</span><span class="Other">}</span></pre></dt> <dd> Escape characters. </dd> </div> <div id="LETTER"> <dt><pre><a href="minline.html#LETTER"><span class="Identifier">LETTER</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">65</span><span class="Other">..</span><span class="DecNumber">122</span><span class="Other">}</span></pre></dt> <dd> Letters. </dd> </div> <div id="LOWERLETTER"> <dt><pre><a href="minline.html#LOWERLETTER"><span class="Identifier">LOWERLETTER</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">97</span><span class="Other">..</span><span class="DecNumber">122</span><span class="Other">}</span></pre></dt> <dd> Lowercase letters. </dd> </div> <div id="PRINTABLE"> <dt><pre><a href="minline.html#PRINTABLE"><span class="Identifier">PRINTABLE</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">32</span><span class="Other">..</span><span class="DecNumber">126</span><span class="Other">}</span></pre></dt> <dd> Printable characters. </dd> </div> <div id="UPPERLETTER"> <dt><pre><a href="minline.html#UPPERLETTER"><span class="Identifier">UPPERLETTER</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">65</span><span class="Other">..</span><span class="DecNumber">90</span><span class="Other">}</span></pre></dt> <dd> Uppercase letters. </dd> </div> </dl></div> <div class="section" id="12"> <h1><a class="toc-backref" href="#12">Procs</a></h1> <dl class="item"> <div id="back,LineEditor,int"> <dt><pre><span class="Keyword">proc</span> <a href="#back%2CLineEditor%2Cint"><span class="Identifier">back</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">;</span> <span class="Identifier">n</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Move the cursor back by <strong>n</strong> characters on the current line (unless the beginning of the line is reached). </dd> </div> <div id="changeLine,LineEditor,string"> <dt><pre><span class="Keyword">proc</span> <a href="#changeLine%2CLineEditor%2Cstring"><span class="Identifier">changeLine</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Replaces the contents of the current line with the string <strong>s</strong>. </dd> </div> <div id="clearLine,LineEditor"> <dt><pre><span class="Keyword">proc</span> <a href="#clearLine%2CLineEditor"><span class="Identifier">clearLine</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Clears the contents of the current line and reset the cursor position to the beginning of the line. </dd> </div> <div id="completeLine,LineEditor"> <dt><pre><span class="Keyword">proc</span> <a href="#completeLine%2CLineEditor"><span class="Identifier">completeLine</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">EOFError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>If a <strong>completionCallback</strong> proc has been specified for the current editor, attempts to auto-complete the current line by running <strong>completionProc</strong> to return a list of possible values. It is possible to cycle through the matches by pressing the same key that triggered this proc.</p> <p>The matches provided will be filtered based on the contents of the line when this proc was first triggered. If a match starts with the contents of the line, it will be displayed.</p> <p>The following is a real-world example of a <strong>completionCallback</strong> used to complete the last word on the line with valid file paths.</p> <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">sequtils</span><span class="Punctuation">,</span> <span class="Identifier">strutils</span><span class="Punctuation">,</span> <span class="Identifier">ospath</span> <span class="Identifier">ed</span><span class="Operator">.</span><span class="Identifier">completionCallback</span> <span class="Operator">=</span> <span class="Keyword">proc</span><span class="Punctuation">(</span><span class="Identifier">ed</span><span class="Punctuation">:</span> <span class="Identifier">LineEditor</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Keyword">var</span> <span class="Identifier">words</span> <span class="Operator">=</span> <span class="Identifier">ed</span><span class="Operator">.</span><span class="Identifier">lineText</span><span class="Operator">.</span><span class="Identifier">split</span><span class="Punctuation">(</span><span class="StringLit">" "</span><span class="Punctuation">)</span> <span class="Keyword">var</span> <span class="Identifier">word</span><span class="Punctuation">:</span> <span class="Identifier">string</span> <span class="Keyword">if</span> <span class="Identifier">words</span><span class="Operator">.</span><span class="Identifier">len</span> <span class="Operator">==</span> <span class="DecNumber">0</span><span class="Punctuation">:</span> <span class="Identifier">word</span> <span class="Operator">=</span> <span class="Identifier">ed</span><span class="Operator">.</span><span class="Identifier">lineText</span> <span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">word</span> <span class="Operator">=</span> <span class="Identifier">words</span><span class="Punctuation">[</span><span class="Identifier">words</span><span class="Operator">.</span><span class="Identifier">len</span><span class="Operator">-</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">word</span><span class="Punctuation">[</span><span class="FloatNumber">1.</span><span class="Operator">.^</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Keyword">if</span> <span class="Identifier">f</span> <span class="Operator">==</span> <span class="StringLit">""</span><span class="Punctuation">:</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">getCurrentDir</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">replace</span><span class="Punctuation">(</span><span class="StringLit">"</span><span class="EscapeSequence">\\</span><span class="StringLit">"</span><span class="Punctuation">,</span> <span class="StringLit">"/"</span><span class="Punctuation">)</span> <span class="Keyword">return</span> <span class="Identifier">toSeq</span><span class="Punctuation">(</span><span class="Identifier">walkDir</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Punctuation">,</span> <span class="Identifier">true</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">.</span><span class="Identifier">mapIt</span><span class="Punctuation">(</span><span class="StringLit">"</span><span class="EscapeSequence">\"</span><span class="StringLit">$1"</span> <span class="Operator">%</span> <span class="Identifier">it</span><span class="Operator">.</span><span class="Identifier">path</span><span class="Operator">.</span><span class="Identifier">replace</span><span class="Punctuation">(</span><span class="StringLit">"</span><span class="EscapeSequence">\\</span><span class="StringLit">"</span><span class="Punctuation">,</span> <span class="StringLit">"/"</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Keyword">elif</span> <span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">dirExists</span><span class="Punctuation">:</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">replace</span><span class="Punctuation">(</span><span class="StringLit">"</span><span class="EscapeSequence">\\</span><span class="StringLit">"</span><span class="Punctuation">,</span> <span class="StringLit">"/"</span><span class="Punctuation">)</span> <span class="Keyword">if</span> <span class="Identifier">f</span><span class="Punctuation">[</span><span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">len</span><span class="Operator">-</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">!=</span> <span class="CharLit">'/'</span><span class="Punctuation">:</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">f</span> <span class="Operator">&</span> <span class="StringLit">"/"</span> <span class="Keyword">return</span> <span class="Identifier">toSeq</span><span class="Punctuation">(</span><span class="Identifier">walkDir</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Punctuation">,</span> <span class="Identifier">true</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">.</span><span class="Identifier">mapIt</span><span class="Punctuation">(</span><span class="StringLit">"</span><span class="EscapeSequence">\"</span><span class="StringLit">$1$2"</span> <span class="Operator">%</span> <span class="Punctuation">[</span><span class="Identifier">f</span><span class="Punctuation">,</span> <span class="Identifier">it</span><span class="Operator">.</span><span class="Identifier">path</span><span class="Operator">.</span><span class="Identifier">replace</span><span class="Punctuation">(</span><span class="StringLit">"</span><span class="EscapeSequence">\\</span><span class="StringLit">"</span><span class="Punctuation">,</span> <span class="StringLit">"/"</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">dir</span><span class="Punctuation">:</span> <span class="Identifier">string</span> <span class="Keyword">if</span> <span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">contains</span><span class="Punctuation">(</span><span class="StringLit">"/"</span><span class="Punctuation">)</span> <span class="Keyword">or</span> <span class="Identifier">dir</span><span class="Operator">.</span><span class="Identifier">contains</span><span class="Punctuation">(</span><span class="StringLit">"</span><span class="EscapeSequence">\\</span><span class="StringLit">"</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">dir</span> <span class="Operator">=</span> <span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">parentDir</span> <span class="Keyword">let</span> <span class="Identifier">file</span> <span class="Operator">=</span> <span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">extractFileName</span> <span class="Keyword">return</span> <span class="Identifier">toSeq</span><span class="Punctuation">(</span><span class="Identifier">walkDir</span><span class="Punctuation">(</span><span class="Identifier">dir</span><span class="Punctuation">,</span> <span class="Identifier">true</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">.</span><span class="Identifier">filterIt</span><span class="Punctuation">(</span><span class="Identifier">it</span><span class="Operator">.</span><span class="Identifier">path</span><span class="Operator">.</span><span class="Identifier">toLowerAscii</span><span class="Operator">.</span><span class="Identifier">startsWith</span><span class="Punctuation">(</span><span class="Identifier">file</span><span class="Operator">.</span><span class="Identifier">toLowerAscii</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">.</span><span class="Identifier">mapIt</span><span class="Punctuation">(</span><span class="StringLit">"</span><span class="EscapeSequence">\"</span><span class="StringLit">$1/$2"</span> <span class="Operator">%</span> <span class="Punctuation">[</span><span class="Identifier">dir</span><span class="Punctuation">,</span> <span class="Identifier">it</span><span class="Operator">.</span><span class="Identifier">path</span><span class="Operator">.</span><span class="Identifier">replace</span><span class="Punctuation">(</span><span class="StringLit">"</span><span class="EscapeSequence">\\</span><span class="StringLit">"</span><span class="Punctuation">,</span> <span class="StringLit">"/"</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">dir</span> <span class="Operator">=</span> <span class="Identifier">getCurrentDir</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Keyword">return</span> <span class="Identifier">toSeq</span><span class="Punctuation">(</span><span class="Identifier">walkDir</span><span class="Punctuation">(</span><span class="Identifier">dir</span><span class="Punctuation">,</span> <span class="Identifier">true</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">.</span><span class="Identifier">filterIt</span><span class="Punctuation">(</span><span class="Identifier">it</span><span class="Operator">.</span><span class="Identifier">path</span><span class="Operator">.</span><span class="Identifier">toLowerAscii</span><span class="Operator">.</span><span class="Identifier">startsWith</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">toLowerAscii</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">.</span><span class="Identifier">mapIt</span><span class="Punctuation">(</span><span class="StringLit">"</span><span class="EscapeSequence">\"</span><span class="StringLit">$1"</span> <span class="Operator">%</span> <span class="Punctuation">[</span><span class="Identifier">it</span><span class="Operator">.</span><span class="Identifier">path</span><span class="Operator">.</span><span class="Identifier">replace</span><span class="Punctuation">(</span><span class="StringLit">"</span><span class="EscapeSequence">\\</span><span class="StringLit">"</span><span class="Punctuation">,</span> <span class="StringLit">"/"</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">)</span></pre> </dd> </div> <div id="deleteNext,LineEditor"> <dt><pre><span class="Keyword">proc</span> <a href="#deleteNext%2CLineEditor"><span class="Identifier">deleteNext</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">LineError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Move the cursor to the right by one character (unless at the end of the line) and delete the existing character, if any. </dd> </div> <div id="deletePrevious,LineEditor"> <dt><pre><span class="Keyword">proc</span> <a href="#deletePrevious%2CLineEditor"><span class="Identifier">deletePrevious</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">LineError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Move the cursor to the left by one character (unless at the beginning of the line) and delete the existing character, if any. </dd> </div> <div id="forward,LineEditor,int"> <dt><pre><span class="Keyword">proc</span> <a href="#forward%2CLineEditor%2Cint"><span class="Identifier">forward</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">;</span> <span class="Identifier">n</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Move the cursor forward by <strong>n</strong> characters on the current line (unless the beginning of the line is reached). </dd> </div> <div id="getchr"> <dt><pre><span class="Keyword">proc</span> <a href="#getchr"><span class="Identifier">getchr</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">EOFError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Retrieves an ASCII character from stdin. </dd> </div> <div id="goToEnd,LineEditor"> <dt><pre><span class="Keyword">proc</span> <a href="#goToEnd%2CLineEditor"><span class="Identifier">goToEnd</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Move the cursor to the end of the line. </dd> </div> <div id="goToStart,LineEditor"> <dt><pre><span class="Keyword">proc</span> <a href="#goToStart%2CLineEditor"><span class="Identifier">goToStart</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Move the cursor to the beginning of the line. </dd> </div> <div id="historyAdd,LineEditor"> <dt><pre><span class="Keyword">proc</span> <a href="#historyAdd%2CLineEditor"><span class="Identifier">historyAdd</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">;</span> <span class="Identifier">force</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Adds the current editor line to the history. If <strong>force</strong> is set to <strong>true</strong>, the line will be added even if it's blank. </dd> </div> <div id="historyFlush,LineEditor"> <dt><pre><span class="Keyword">proc</span> <a href="#historyFlush%2CLineEditor"><span class="Identifier">historyFlush</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> If there is at least one entry in the history, it sets the position of the cursor to the last element and sets the <strong>tainted</strong> flag to <strong>false</strong>. </dd> </div> <div id="historyInit,int,string"> <dt><pre><span class="Keyword">proc</span> <a href="#historyInit%2Cint%2Cstring"><span class="Identifier">historyInit</span></a><span class="Other">(</span><span class="Identifier">size</span> <span class="Other">=</span> <span class="DecNumber">256</span><span class="Other">;</span> <span class="Identifier">file</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Other">=</span> <span class="StringLit">""</span><span class="Other">)</span><span class="Other">:</span> <a href="minline.html#LineHistory"><span class="Identifier">LineHistory</span></a> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Creates a new <strong>LineHistory</strong> object with the specified <strong>size</strong> and <strong>file</strong>. </dd> </div> <div id="historyNext,LineEditor"> <dt><pre><span class="Keyword">proc</span> <a href="#historyNext%2CLineEditor"><span class="Identifier">historyNext</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Replaces the contents of the current line with the following line stored in the history (if any). </dd> </div> <div id="historyPrevious,LineEditor"> <dt><pre><span class="Keyword">proc</span> <a href="#historyPrevious%2CLineEditor"><span class="Identifier">historyPrevious</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Replaces the contents of the current line with the previous line stored in the history (if any). The current line will be added to the history and the hisory will be marked as <em>tainted</em>. </dd> </div> <div id="initEditor,int,string"> <dt><pre><span class="Keyword">proc</span> <a href="#initEditor%2Cint%2Cstring"><span class="Identifier">initEditor</span></a><span class="Other">(</span><span class="Identifier">mode</span> <span class="Other">=</span> <span class="Identifier">mdInsert</span><span class="Other">;</span> <span class="Identifier">historySize</span> <span class="Other">=</span> <span class="DecNumber">256</span><span class="Other">;</span> <span class="Identifier">historyFile</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Other">=</span> <span class="StringLit">""</span><span class="Other">)</span><span class="Other">:</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Creates a <strong>LineEditor</strong> object. </dd> </div> <div id="lineText,LineEditor"> <dt><pre><span class="Keyword">proc</span> <a href="#lineText%2CLineEditor"><span class="Identifier">lineText</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Returns the contents of the current line. </dd> </div> <div id="password,LineEditor,string"> <dt><pre><span class="Keyword">proc</span> <a href="#password%2CLineEditor%2Cstring"><span class="Identifier">password</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">;</span> <span class="Identifier">prompt</span> <span class="Other">=</span> <span class="StringLit">""</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">EOFError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Convenience method to use instead of <strong>readLine</strong> to hide the characters inputed by the user. </dd> </div> <div id="printChar,LineEditor,int"> <dt><pre><span class="Keyword">proc</span> <a href="#printChar%2CLineEditor%2Cint"><span class="Identifier">printChar</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">;</span> <span class="Identifier">c</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">LineError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> Prints the character <strong>c</strong> to the current line. If in the middle of the line, the following characters are shifted right or replaced depending on the editor mode. </dd> </div> <div id="putchr,cint"> <dt><pre><span class="Keyword">proc</span> <a href="#putchr%2Ccint"><span class="Identifier">putchr</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span> {.<span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">"stdio.h"</span><span class="Other">,</span> <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"putchar"</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Prints an ASCII character to stdout. </dd> </div> <div id="readLine,LineEditor,string"> <dt><pre><span class="Keyword">proc</span> <a href="#readLine%2CLineEditor%2Cstring"><span class="Identifier">readLine</span></a><span class="Other">(</span><span class="Identifier">ed</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minline.html#LineEditor"><span class="Identifier">LineEditor</span></a><span class="Other">;</span> <span class="Identifier">prompt</span> <span class="Other">=</span> <span class="StringLit">""</span><span class="Other">;</span> <span class="Identifier">hidechars</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">EOFError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>High-level proc to be used instead of <strong>stdin.readLine</strong> to read a line from standard input using the specified <strong>LineEditor</strong> object.</p> <p>Note that:</p> <ul class="simple"><li><strong>prompt</strong> is a string (that <em>cannot</em> contain escape codes, so it cannot be colored) that will be prepended at the start of the line and not included in the contents of the line itself.</li> <li>If <strong>hidechars</strong> is set to <strong>true</strong>, asterisks will be printed to stdout instead of the characters entered by the user.</li> </ul> </dd> </div> </dl></div> </div> </div> <div class="row"> <div class="twelve-columns footer"> <span class="nim-sprite"></span> <br/> <small style="color: var(--hint);">Made with Nim. Generated: 2023-07-30 20:08:27 UTC</small> </div> </div> </div> </div> </body> </html> |