changeset 2305:5b1a63dc2b1a

[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.
author Holger Weiß <holger@zedat.fu-berlin.de>
date Fri, 24 Jul 2015 02:37:07 +0200
parents fa8365fb6ac2
children 7afb9a0c6409
files mcabber/mcabber/screen.c
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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