1
0
mirror of https://github.com/irssi/irssi.git synced 2024-07-21 03:14:16 -04:00

Merge pull request #979 from ailin-nemui/completion-keep-word

add keep_word setting to completion
This commit is contained in:
ailin-nemui 2018-12-04 17:01:33 +01:00 committed by GitHub
commit 40f5edf105
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -229,6 +229,7 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, i
g_list_first(complist);
want_space = last_want_space;
} else {
int keep_word = settings_get_bool("completion_keep_word");
/* get new completion list */
free_completions();
@ -239,6 +240,17 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, i
if (complist != NULL) {
/* Remove all nulls (from the signal) before doing further processing */
complist = g_list_remove_all(g_list_first(complist), NULL);
if (keep_word) {
complist = g_list_append(complist, g_strdup(word));
}
if (backward) {
complist = g_list_last(complist);
if (keep_word) {
complist = complist->prev;
}
}
}
}
@ -897,6 +909,7 @@ void completion_init(void)
chat_completion_init();
settings_add_bool("completion", "completion_keep_word", TRUE);
command_bind("completion", NULL, (SIGNAL_FUNC) cmd_completion);
signal_add_first("complete word", (SIGNAL_FUNC) sig_complete_word);