all repos — minline @ c226197d60eb9ff637c1228e679e7d99fe1b6282

A minimalist but highly-customizable line editing library.

Fixed compilation errors on Nim 0.18.0.
h3rald h3rald@h3rald.com
Sat, 03 Mar 2018 16:24:33 +0100
commit

c226197d60eb9ff637c1228e679e7d99fe1b6282

parent

77f01870231505cf3c51490736b05c97df432eb6

1 files changed, 7 insertions(+), 7 deletions(-)

jump to
M nimline.nimnimline.nim

@@ -16,7 +16,7 @@ proc putchr*(c: cint) =

stdout.write(c.chr) proc getchr*(): cint = - return getch().ord + return getch().ord.cint # Types

@@ -138,7 +138,7 @@ else:

let rest = ed.line.toEnd & " " ed.back for i in rest: - putchr i.ord + putchr i.ord.cint ed.line.text = ed.line.fromStart & ed.line.text[ed.line.position+1..ed.line.last] stdout.cursorBackward(rest.len)

@@ -147,7 +147,7 @@ if not ed.line.empty:

if not ed.line.full: let rest = ed.line.toEnd[1..^1] & " " for c in rest: - putchr c.ord + putchr c.ord.cint stdout.cursorBackward(rest.len) ed.line.text = ed.line.fromStart & ed.line.toEnd[1..^1]

@@ -163,7 +163,7 @@ let rest = ed.line.toEnd

ed.line.text.insert($c.chr, ed.line.position) ed.line.position += 1 for j in rest: - putchr(j.ord) + putchr(j.ord.cint) ed.line.position += 1 ed.back(rest.len) else:

@@ -178,7 +178,7 @@ let position = ed.line.position

if position > 0: stdout.cursorBackward(position) for c in s: - putchr(c.ord) + putchr(c.ord.cint) ed.line.position = s.len ed.line.text = s if diff > 0:

@@ -188,7 +188,7 @@ stdout.cursorBackward(diff)

proc addToLineAtPosition(ed: var LineEditor, s: string) = for c in s: - ed.printChar(c.ord) + ed.printChar(c.ord.cint) proc clearLine*(ed: var LineEditor) = stdout.cursorBackward(ed.line.position+1)

@@ -429,7 +429,7 @@ elif c1 in {8, 127}:

KEYMAP["backspace"](ed) elif c1 in PRINTABLE: if hidechars: - putchr('*'.ord) + putchr('*'.ord.cint) ed.line.text &= c1.chr ed.line.position.inc else: