aboutsummaryrefslogtreecommitdiff
path: root/window-copy.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2018-04-23 17:02:32 +0100
committerThomas Adam <thomas@xteddy.org>2018-04-23 17:02:32 +0100
commitd24bd7394d1547c1eb0a3eb85364d5eb07fcd2ef (patch)
treecd27a65adb6d8bc754629dbc39b26ef909c59884 /window-copy.c
parentaebb17dc75f60edc1817d670f978b71d8f327228 (diff)
parentd9d2f84a4b143d4f45dc11ed31573f667868e5eb (diff)
downloadrtmux-d24bd7394d1547c1eb0a3eb85364d5eb07fcd2ef.tar.gz
rtmux-d24bd7394d1547c1eb0a3eb85364d5eb07fcd2ef.tar.bz2
rtmux-d24bd7394d1547c1eb0a3eb85364d5eb07fcd2ef.zip
Merge branch 'obsd-master'
Diffstat (limited to 'window-copy.c')
-rw-r--r--window-copy.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/window-copy.c b/window-copy.c
index 6eb3d435..09025497 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -1548,7 +1548,7 @@ window_copy_get_selection(struct window_pane *wp, size_t *len)
char *buf;
size_t off;
u_int i, xx, yy, sx, sy, ex, ey, ey_last;
- u_int firstsx, lastex, restex, restsx;
+ u_int firstsx, lastex, restex, restsx, selx;
int keys;
if (!s->sel.flag && s->sel.lineflag == LINE_SEL_NONE)
@@ -1599,7 +1599,11 @@ window_copy_get_selection(struct window_pane *wp, size_t *len)
* Need to ignore the column with the cursor in it, which for
* rectangular copy means knowing which side the cursor is on.
*/
- if (data->selx < data->cx) {
+ if (data->cursordrag == CURSORDRAG_ENDSEL)
+ selx = data->selx;
+ else
+ selx = data->endselx;
+ if (selx < data->cx) {
/* Selection start is on the left. */
if (keys == MODEKEY_EMACS) {
lastex = data->cx;
@@ -1609,12 +1613,12 @@ window_copy_get_selection(struct window_pane *wp, size_t *len)
lastex = data->cx + 1;
restex = data->cx + 1;
}
- firstsx = data->selx;
- restsx = data->selx;
+ firstsx = selx;
+ restsx = selx;
} else {
/* Cursor is on the left. */
- lastex = data->selx + 1;
- restex = data->selx + 1;
+ lastex = selx + 1;
+ restex = selx + 1;
firstsx = data->cx;
restsx = data->cx;
}