summaryrefslogtreecommitdiff
path: root/src/fe-common/core/completion.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-01-28 03:04:44 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-01-28 03:04:44 +0000
commit00492856da793220840d7f1fc1b4126083bf1dc4 (patch)
treee682511e96e20c1d7a164625469ae090e37a4ee9 /src/fe-common/core/completion.c
parent4cbabe2a83541fec27679cfd23fb460af279c84e (diff)
downloadirssi-00492856da793220840d7f1fc1b4126083bf1dc4.zip
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
Diffstat (limited to 'src/fe-common/core/completion.c')
-rw-r--r--src/fe-common/core/completion.c11
1 files 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;
}