From 00492856da793220840d7f1fc1b4126083bf1dc4 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 28 Jan 2001 03:04:44 +0000 Subject: [PATCH] Spaces at the start of line confused the completion some. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1144 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/completion.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c index a61d63b7..3c41eeee 100644 --- a/src/fe-common/core/completion.c +++ b/src/fe-common/core/completion.c @@ -140,7 +140,14 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos) wordlen = strlen(word); /* get the start of line until the word we're completing */ - while (wordstart > line && isseparator(wordstart[-1])) wordstart--; + if (isseparator(*line)) { + /* empty space at the start of line */ + if (wordstart == line) + wordstart += strlen(wordstart); + } else { + while (wordstart > line && isseparator(wordstart[-1])) + wordstart--; + } linestart = g_strndup(line, (int) (wordstart-line)); /* completions usually add space after the word, that makes @@ -160,7 +167,7 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos) g_free(word); word = g_strdup(""); - startpos = strlen(linestart)+1;/*(int) (wordstart-line)+wordlen+1*/; + startpos = strlen(linestart)+1; wordlen = 0; }