diff options
| author | Quentin Carbonneaux | 2014-09-05 21:02:12 -0400 |
|---|---|---|
| committer | Quentin Carbonneaux | 2014-09-05 21:02:12 -0400 |
| commit | 7b186bbeef8d205a90b800a69bb7504c7c3614fd (patch) | |
| tree | 40a21b6a58a6f21809375e3e133d133ccaeaa68e | |
| parent | bf4a4fdd88c686a0774d8321c6462fbe4588362a (diff) | |
use middle button to execute a command
| -rw-r--r-- | exec.c | 10 | ||||
| -rw-r--r-- | exec.h | 2 | ||||
| -rw-r--r-- | main.c | 3 | ||||
| -rw-r--r-- | vicmd.w | 2 |
4 files changed, 10 insertions, 7 deletions
@@ -53,15 +53,15 @@ static ECmd etab[] = { * the list of builtins, if not found, it is run in a shell. */ int -ex_run(unsigned p0) +ex_run(W *w, unsigned p0) { unsigned p1; ECmd *e; - e = lookup(&curwin->eb->b, p0, &p1); - if (e && e->f(win_text(curwin), curwin->eb, p1)) - if (win_text(curwin) != curwin) - curwin = win_tag_toggle(curwin); + 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); return 0; } @@ -1,4 +1,4 @@ -int ex_run(unsigned); +int ex_run(W *, unsigned); int ex_look(W *, Rune *, unsigned); int ex_put(EBuf *, char *); int ex_get(EBuf *, char *); @@ -103,6 +103,9 @@ gev(int fd, int flag, void *unused) eb_setmark(curwin->eb, SelEnd, p1); } goto Setcursor; + } else if (e.mouse.button == GBMiddle) { + p0 = win_at(mousewin, e.mouse.x, e.mouse.y); + ex_run(mousewin, p0); } else if (e.mouse.button == GBWheelUp) { win_scroll(mousewin, -4); } else if (e.mouse.button == GBWheelDown) { @@ -1121,7 +1121,7 @@ static int a_tag(char buf, Cmd c, Cmd mc) static int a_run(char buf, Cmd c, Cmd mc) { (void)buf; @+(void) c; @+(void) mc; - return ex_run(curwin->cu); + return ex_run(curwin, curwin->cu); } @ The insertion commands are all treated in the following procedure. |
