all repos — min @ 692965975c68ee3979ad16daa5ff3fb8f3d6aae0

A small but practical concatenative programming language.

Enabled auto-completion after typing the first word.
h3rald h3rald@h3rald.com
Mon, 08 Dec 2014 20:35:41 +0100
commit

692965975c68ee3979ad16daa5ff3fb8f3d6aae0

parent

77b753fe9ce03c03e6ba5c02e5e8057c75a44076

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

jump to
M minim.nimminim.nim

@@ -48,9 +48,14 @@ stderr.flushFile()

minimStream(stream, filename) proc completionCallback*(str: cstring, completions: ptr linenoiseCompletions) = + var words = ($str).split(" ") + var w = words.pop + var sep = "" + if words.len > 0: + sep = " " for s in SYMBOLS.keys: - if startsWith(s, $str): - linenoiseAddCompletion completions, s + if startsWith(s, w): + linenoiseAddCompletion completions, words.join(" ") & sep & s proc minimRepl*() = var i = newMinInterpreter(debugging)