moves incsearch to ex_input_changed (closes #370)
authorRobert Timm <mail@rtti.de>
Mon, 17 Apr 2017 20:41:15 +0000 (22:41 +0200)
committerRobert Timm <mail@rtti.de>
Fri, 21 Apr 2017 06:17:08 +0000 (08:17 +0200)
src/ex.c

index 79191b2..20e0eaa 100644 (file)
--- a/src/ex.c
+++ b/src/ex.c
@@ -348,15 +348,6 @@ VbResult ex_keypress(Client *c, int key)
         }
     }
 
-    if (c->config.incsearch && key != KEY_CR) {
-        gtk_text_buffer_get_bounds(buffer, &start, &end);
-        text = gtk_text_buffer_get_text(buffer, &start, &end, false);
-        if (text && (*text == '/' || *text == '?')) {
-            command_search(c, &((Arg){0, NULL})); /* stop last search */
-            command_search(c, &((Arg){*text == '/' ? 1 : -1, (char*)text + 1}));
-        }
-    }
-
     /* if the user deleted some content of the inputbox we check if the
      * inputbox is empty - if so we switch back to normal like vim does */
     if (check_empty) {
@@ -398,6 +389,13 @@ void ex_input_changed(Client *c, const char *text)
         case 'g':
             /* TODO create hints */
             break;
+        case '/': /* fall through */
+        case '?':
+            if (c->config.incsearch) {
+                command_search(c, &((Arg){0, NULL})); /* stop last search */
+                command_search(c, &((Arg){*text == '/' ? 1 : -1, (char*)text + 1}));
+            }
+            break;
     }
 }