diff options
| author | Quentin Carbonneaux | 2014-08-05 17:39:47 -0400 |
|---|---|---|
| committer | Quentin Carbonneaux | 2014-08-05 17:39:47 -0400 |
| commit | 856ef05c0a2df889a42b059b4e78bc3126282718 (patch) | |
| tree | 8370417a92b3e5277ae31ae53f4869a3a8a5c68a | |
| parent | 5e3013127f0bf1110a81cd737d6b84d51576865d (diff) | |
add mouse selection
| -rw-r--r-- | main.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -27,6 +27,7 @@ die(char *m) static int gev(int fd, int flag, void *unused) { + static int issel; GEvent e; (void) fd; @@ -51,9 +52,19 @@ gev(int fd, int flag, void *unused) if (e.mouse.button == GBLeft) win_set_cursor(curwin, e.mouse.x, e.mouse.y); break; + case GMouseSelect: + win_set_cursor(curwin, e.mouse.x, e.mouse.y); + if (issel) + eb_setmark(curwin->eb, SelEnd, curwin->cu); + else + eb_setmark(curwin->eb, SelBeg, curwin->cu); + issel = 1; + goto Select; default: break; } + issel = 0; + Select: if (curwin->cu >= curwin->l[curwin->nl]) curwin->cu = curwin->l[curwin->nl-1]; |
