summaryrefslogtreecommitdiffstats
path: root/screen.c
diff options
context:
space:
mode:
authornicm <nicm>2019-01-15 09:56:31 +0000
committernicm <nicm>2019-01-15 09:56:31 +0000
commit34c0807be6add421bc4624d498adf9f55d00a120 (patch)
tree48abc96ca95e088eb6a7ba2c65c9d95596d8e19c /screen.c
parentbde0224deb0d0ba87929d2abfb262f3bd187b889 (diff)
Do not highlight characters which will not be copied, reported by
Jaroslaw Rzeszotko.
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/screen.c b/screen.c
index 6fbd86f4..75d9d09d 100644
--- a/screen.c
+++ b/screen.c
@@ -425,7 +425,11 @@ screen_check_selection(struct screen *s, u_int px, u_int py)
if (py == sel->sy && px < sel->sx)
return (0);
- if (py == sel->ey && px > sel->ex)
+ if (sel->modekeys == MODEKEY_EMACS)
+ xx = (sel->ex == 0 ? 0 : sel->ex - 1);
+ else
+ xx = sel->ex;
+ if (py == sel->ey && px > xx)
return (0);
} else if (sel->sy > sel->ey) {
/* starting line > ending line -- upward selection. */
@@ -456,7 +460,11 @@ screen_check_selection(struct screen *s, u_int px, u_int py)
return (0);
} else {
/* selection start (sx) is on the left */
- if (px < sel->sx || px > sel->ex)
+ if (sel->modekeys == MODEKEY_EMACS)
+ xx = (sel->ex == 0 ? 0 : sel->ex - 1);
+ else
+ xx = sel->ex;
+ if (px < sel->sx || px > xx)
return (0);
}
}