[PATCH 2/3] Don't complete "/search" string in vi mode
If vi_mode is set to 1 and the user is currently in non-chat mode,
disable completion when the input line starts with a slash. Only
commands entered with a leading colon should be completed in this mode.
--- a/mcabber/mcabber/screen.c Wed Jul 22 19:25:22 2015 +0200
+++ b/mcabber/mcabber/screen.c Fri Jul 24 02:37:07 2015 +0200
@@ -4476,6 +4476,7 @@
int key = kcode.value;
int display_char = FALSE;
int vi_completion = FALSE;
+ int vi_search = FALSE;
static int ex_or_search_mode = FALSE;
lock_chatstate = FALSE;
@@ -4509,9 +4510,14 @@
break;
case 9: // Tab
case 353: // Shift-Tab
- if (inputLine[0] == ':') {
- inputLine[0] = '/';
- vi_completion = TRUE;
+ switch (inputLine[0]) {
+ case ':':
+ inputLine[0] = '/';
+ vi_completion = TRUE;
+ break;
+ case '/':
+ vi_search = TRUE;
+ break;
}
break;
case 13: // Enter
@@ -4751,10 +4757,12 @@
case ERR:
break;
case 9: // Tab
- readline_do_completion(TRUE); // Forward-completion
+ if (!vi_search)
+ readline_do_completion(TRUE); // Forward-completion
break;
case 353: // Shift-Tab
- readline_do_completion(FALSE); // Backward-completion
+ if (!vi_search)
+ readline_do_completion(FALSE); // Backward-completion
break;
case 13: // Enter
case 343: // Enter on Maemo