diff options
author | Thomas Adam <thomas@xteddy.org> | 2014-09-25 11:29:54 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2014-09-25 11:29:54 +0100 |
commit | 2874a431c050527244a56e7f241baf053c722f88 (patch) | |
tree | bfbd88ff749ef321ef2ba1b53f10246cc87ef85a /screen.c | |
parent | 5e7f1b9f0a5bcff8f9ba410c17de4e822428614c (diff) | |
parent | 21062d74d5373699aad9fe8d77bd5312a33e9834 (diff) | |
download | rtmux-2874a431c050527244a56e7f241baf053c722f88.tar.gz rtmux-2874a431c050527244a56e7f241baf053c722f88.tar.bz2 rtmux-2874a431c050527244a56e7f241baf053c722f88.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'screen.c')
-rw-r--r-- | screen.c | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -277,6 +277,7 @@ int screen_check_selection(struct screen *s, u_int px, u_int py) { struct screen_sel *sel = &s->sel; + u_int xx; if (!sel->flag) return (0); @@ -326,16 +327,24 @@ screen_check_selection(struct screen *s, u_int px, u_int py) if (py < sel->sy || py > sel->ey) return (0); - if ((py == sel->sy && px < sel->sx) - || (py == sel->ey && px > sel->ex)) + if (py == sel->sy && px < sel->sx) + return (0); + + if (py == sel->ey && px > sel->ex) return (0); } else if (sel->sy > sel->ey) { /* starting line > ending line -- upward selection. */ if (py > sel->sy || py < sel->ey) return (0); - if ((py == sel->sy && px >= sel->sx) - || (py == sel->ey && px < sel->ex)) + if (py == sel->ey && px < sel->ex) + return (0); + + if (sel->modekeys == MODEKEY_EMACS) + xx = sel->sx - 1; + else + xx = sel->sx; + if (py == sel->sy && px > xx) return (0); } else { /* starting line == ending line. */ @@ -344,7 +353,11 @@ screen_check_selection(struct screen *s, u_int px, u_int py) if (sel->ex < sel->sx) { /* cursor (ex) is on the left */ - if (px > sel->sx || px < sel->ex) + if (sel->modekeys == MODEKEY_EMACS) + xx = sel->sx - 1; + else + xx = sel->sx; + if (px > xx || px < sel->ex) return (0); } else { /* selection start (sx) is on the left */ |