all repos — minline @ 77f01870231505cf3c51490736b05c97df432eb6

A minimalist but highly-customizable line editing library.

Merge branch 'master' of https://github.com/h3rald/nimline
h3rald h3rald@h3rald.com
Sat, 28 Oct 2017 17:42:47 +0200
commit

77f01870231505cf3c51490736b05c97df432eb6

parent

1e7bf38bb5e1f980ab5114bb9ba84fe3d3c2b278

1 files changed, 8 insertions(+), 4 deletions(-)

jump to
M nimline.nimnimline.nim

@@ -8,11 +8,15 @@ os

system.addQuitProc(resetAttributes) -proc putchr*(c: cint) = - stdout.write(c.chr) +when defined(windows): + proc getchr*(): cint {.header: "<conio.h>", importc: "_getch".} + proc putchr*(c: cint): cint {.discardable, header: "<conio.h>", importc: "_putch".} +else: + proc putchr*(c: cint) = + stdout.write(c.chr) -proc getchr*(): cint = - return getch().ord + proc getchr*(): cint = + return getch().ord # Types