From f05f87862d74442086b2c7916e8b9c90cc647c5a Mon Sep 17 00:00:00 2001 From: jlp765 Date: Sat, 24 Aug 2019 13:53:28 +1000 Subject: [PATCH] Update tnim.nim Handle Linux ^d to exit. Bug fix: range error on string comarison --- tnim.nim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tnim.nim b/tnim.nim index b12ee33..c30ac38 100644 --- a/tnim.nim +++ b/tnim.nim @@ -559,7 +559,7 @@ proc nimEval(inp: string): tuple[res: bool, resStr: string] = # proc() definition on multi lines elif ident > 0 and lastWrd[lastWrd.len-1] == '=': inc(currIndent) - elif iput[0][0..4] == "block": + elif iput[0].startsWith("block"): inc(currIndent) #elif ident != -1: # errMsg("indentation is incorrect") @@ -582,11 +582,13 @@ proc startMsg(): string {.inline.} = # -------------- READ --------------------------- proc readFromStdin(msg: string): string = - result = r"\qc" + # quit without clearing so that work is + # saved if Ctrl-D hit by mistake + result = r"\q" try: result = readLineFromStdin(msg) except: - tnimQuitClear(@[r"\qc"]) + tnimQuit(@[r"\q"]) # -------------- REPL --------------------------- proc REPL() =