all repos — minline @ 6df2312ece1bf8b217995d2eb89bfc4a21c5d74a

A minimalist but highly-customizable line editing library.

Fixed warnings introduced by nim 0.17.0.
h3rald h3rald@h3rald.com
Fri, 02 Jun 2017 18:52:18 +0200
commit

6df2312ece1bf8b217995d2eb89bfc4a21c5d74a

parent

4e12ccf2cc506cd2fb8286822e9338f661d1b96e

1 files changed, 16 insertions(+), 15 deletions(-)

jump to
M nimline.nimnimline.nim

@@ -34,7 +34,8 @@ proc termRestore*() =

discard execCmd "stty </dev/tty " & TERMSETTINGS proc getchar*(): cint = - return stdin.readChar().ord.cint + var chars = newSeq[char](0) + return stdin.readChars(chars, 0, 1).ord.cint proc putchar*(c: cint) = stdout.write(c.chr)

@@ -483,17 +484,17 @@

proc password*(ed: var LineEditor, prompt=""): string = return ed.readLine(prompt, true) -when isMainModule: - proc testChar() = - while true: - let a = getch().ord - echo "\n->", a - if a == 3: - termRestore() - quit(0) - proc testLineEditor() = - while true: - var ed = initEditor(historyFile = nil) - echo "---", ed.readLine("-> "), "---" - - testChar() +#when isMainModule: +# proc testChar() = +# while true: +# let a = getch().ord +# echo "\n->", a +# if a == 3: +# termRestore() +# quit(0) +# proc testLineEditor() = +# while true: +# var ed = initEditor(historyFile = nil) +# echo "---", ed.readLine("-> "), "---" +# +# testChar()