mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
rewrite completion code and check for direct match of separator
This commit is contained in:
parent
e405330e04
commit
2361d4b1e5
@ -187,12 +187,18 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, i
|
|||||||
char *old;
|
char *old;
|
||||||
|
|
||||||
old = linestart;
|
old = linestart;
|
||||||
linestart = *linestart == '\0' ?
|
/* we want to move word into linestart */
|
||||||
g_strdup(word) :
|
if (*linestart == '\0') {
|
||||||
g_strdup_printf("%s%c%s",
|
linestart = g_strdup(word);
|
||||||
/* do not accidentally duplicate the word separator */
|
} else {
|
||||||
line == wordstart - 1 ? "" : linestart,
|
GString *str = g_string_new(linestart);
|
||||||
old_wordstart[-1], word);
|
if (old_wordstart[-1] != str->str[str->len - 1]) {
|
||||||
|
/* do not accidentally duplicate the word separator */
|
||||||
|
g_string_append_c(str, old_wordstart[-1]);
|
||||||
|
}
|
||||||
|
g_string_append(str, word);
|
||||||
|
linestart = g_string_free(str, FALSE);
|
||||||
|
}
|
||||||
g_free(old);
|
g_free(old);
|
||||||
|
|
||||||
g_free(word);
|
g_free(word);
|
||||||
|
Loading…
Reference in New Issue
Block a user