]> git.lizzy.rs Git - linenoise.git/commitdiff
Merge pull request #2 from devurandom/msteveb/feature/completion-at-eol
authorSteve Bennett <steveb@workware.net.au>
Sun, 4 Nov 2012 10:18:42 +0000 (02:18 -0800)
committerSteve Bennett <steveb@workware.net.au>
Sun, 4 Nov 2012 10:18:42 +0000 (02:18 -0800)
Allow tab-completion only at the end of line and replace magic number

linenoise.c

index 5d82865daafc14819a1d2ddee9c0972ccd7f73d1..5e3216e4591d719df286f4ce4c886fcb17232cce 100644 (file)
@@ -955,7 +955,7 @@ static int linenoisePrompt(struct current *current) {
         /* Only autocomplete when the callback is set. It returns < 0 when
          * there was an error reading from fd. Otherwise it will return the
          * character that should be handled next. */
-        if (c == 9 && completionCallback != NULL) {
+        if (c == '\t' && current->pos == current->chars && completionCallback != NULL) {
             c = completeLine(current);
             /* Return on errors */
             if (c < 0) return current->len;