diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2014-10-02 09:29:48 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2014-10-02 09:29:48 +0100 |
commit | 931c17ed4f3ac18470f5b385210d61b24a57b5d4 (patch) | |
tree | 6dbcfe073cec1ba8f34626bdfa04123b621eb9ed /screen.c | |
parent | 24d9dc518de6761f645165d49f321b2b56904fb5 (diff) | |
parent | 2874a431c050527244a56e7f241baf053c722f88 (diff) | |
download | rtmux-931c17ed4f3ac18470f5b385210d61b24a57b5d4.tar.gz rtmux-931c17ed4f3ac18470f5b385210d61b24a57b5d4.tar.bz2 rtmux-931c17ed4f3ac18470f5b385210d61b24a57b5d4.zip |
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
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 */ |