diff options
| author | Quentin Carbonneaux | 2014-10-23 12:12:17 -0400 |
|---|---|---|
| committer | Quentin Carbonneaux | 2014-10-23 12:12:17 -0400 |
| commit | b6d5fb8431a73ce7e4568d26d999b47e7734ba8c (patch) | |
| tree | a2799ef0ab75365d90a18b53af51184253c324f5 | |
| parent | 0fde8d24f4008126d8334ba98939bb268717de43 (diff) | |
reset the command parser state before switching windows
| -rw-r--r-- | cmd.h | 1 | ||||
| -rw-r--r-- | exec.c | 7 | ||||
| -rw-r--r-- | main.c | 21 | ||||
| -rw-r--r-- | vicmd.w | 5 |
4 files changed, 21 insertions, 13 deletions
@@ -1,4 +1,3 @@ extern int mode; void cmd_parse(Rune r); -#define cmd_reset() cmd_parse(GKEsc); @@ -21,6 +21,7 @@ #include "evnt.h" extern W *curwin; +void chwin(W *); void repaint(void); void die(char *); @@ -76,7 +77,7 @@ ex_run(W *w, unsigned p0) e = lookup(&w->eb->b, p0, &p1); if (e && e->f(win_text(w), w->eb, p1)) if (w == curwin && win_text(w) != w) - curwin = win_tag_toggle(w); + chwin(win_tag_toggle(w)); return 0; } @@ -364,7 +365,7 @@ new(W *w, EBuf *eb, unsigned p0) { w = win_new(); if (w) - curwin = win_tag_toggle(w); + chwin(win_tag_toggle(w)); else err(eb, p0, "no more windows"); return 0; @@ -375,7 +376,7 @@ del(W *w, EBuf *eb, unsigned p0) { w = win_kill(w); if (w) - curwin = w; + chwin(w); else err(eb, p0, "last window"); return 0; @@ -27,6 +27,13 @@ static struct gui *g; static int clicks; +void +chwin(W *w) +{ + cmd_parse(GKEsc); /* reset command parser state */ + curwin = w; +} + static int risword(Rune r) { @@ -34,6 +41,12 @@ risword(Rune r) } static void +resetclicks() +{ + clicks = 0; +} + +static void redraw() { static W *old; @@ -46,12 +59,6 @@ redraw() needsredraw = 0; } -static void -resetclicks() -{ - clicks = 0; -} - void repaint() { @@ -98,7 +105,7 @@ gev(int fd, int flag, void *unused) resizing = 1; break; } - curwin = mousewin; + chwin(mousewin); p0 = win_at(mousewin, e.mouse.x, e.mouse.y); selbeg = p0; ev_alarm(DoubleClick, resetclicks); @@ -18,7 +18,7 @@ then executed on the currently focused window. We try to follow the @c @<Header files to include@>@/ -@<External variables@>@/ +@<External variables and functions@>@/ @<Local types@>@/ @<Predeclared functions@>@/ @<File local variables@>@/ @@ -242,6 +242,7 @@ window. This window is accessible via a global program variable. @<External...@>= extern W *curwin; +void chwin(W *); @* Insertion mode. Insertions can be replayed---either using a count or using the repeat command---so we keep track of all the typed runes in the @@ -1117,7 +1118,7 @@ keyboard driven editor with minimal visual footprint. static int a_tag(char buf, Cmd c, Cmd mc) { (void)buf; @+(void)c; @+(void)mc; - curwin = win_tag_toggle(curwin); + chwin(win_tag_toggle(curwin)); return 0; } |
