jal3/example.nim

19 lines
338 B
Nim

import editor
import terminal
let e = newEditor(">>> ")
while true:
let (res, text) = e.read()
if res in {erCtrlC, erCtrlD} or text == "quit":
break
elif text == "clear":
eraseScreen()
setCursorPos(0, 0)
e.updateCursorPos()
continue
if text.len() > 0:
echo text
e.updateCursorPos()
e.destroyEditor()