Skip to content

Commit

Permalink
Update tnim.nim
Browse files Browse the repository at this point in the history
Handle Linux ^d to exit.
Bug fix: range error on string comarison
  • Loading branch information
jlp765 authored Aug 24, 2019
1 parent 0649216 commit f05f878
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tnim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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() =
Expand Down

0 comments on commit f05f878

Please sign in to comment.