fix vi's '?' and '/' commands to correctly set a new direction
authorPaul Fox <pgf@brightstareng.com>
Wed, 5 Mar 2008 16:44:02 +0000 (16:44 -0000)
committerPaul Fox <pgf@brightstareng.com>
Wed, 5 Mar 2008 16:44:02 +0000 (16:44 -0000)
when reusing a previous search pattern.  previously only 'n' and 'N'
reversed directions properly.

editors/vi.c

index d2d26703665f0bb4f52e19c2c815b64e4b806a25..31ad96c026ae45d0552327541adda45f923e8f61 100644 (file)
@@ -3293,8 +3293,11 @@ static void do_cmd(char c)
                buf[0] = c;
                buf[1] = '\0';
                q = get_input_line(buf);        // get input line- use "status line"
-               if (q[0] && !q[1])
+               if (q[0] && !q[1]) {
+                       if (last_search_pattern[0])
+                           last_search_pattern[0] = c;
                        goto dc3; // if no pat re-use old pat
+               }
                if (q[0]) {       // strlen(q) > 1: new pat- save it and find
                        // there is a new pat
                        free(last_search_pattern);