diff options
author | 2014-06-19 07:37:59 +0000 | |
---|---|---|
committer | 2014-06-19 07:37:59 +0000 | |
commit | 8505bcc5f7cae67cc4aa8ec091a3cfaf97862c1c (patch) | |
tree | 5b91d5bc63413353ccdace7f4c4f7e01f98a20db | |
parent | Reset the buttons when the wheel is used, from Balazs Kezes. (diff) | |
download | wireguard-openbsd-8505bcc5f7cae67cc4aa8ec091a3cfaf97862c1c.tar.xz wireguard-openbsd-8505bcc5f7cae67cc4aa8ec091a3cfaf97862c1c.zip |
Copy newline when at EOL in vi(1) mode, from Balazs Kezes.
-rw-r--r-- | usr.bin/tmux/window-copy.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 85510368c87..0e0d1ee3bd1 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.110 2014/05/14 06:39:58 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.111 2014/06/19 07:37:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1360,7 +1360,7 @@ window_copy_get_selection(struct window_pane *wp, size_t *len) struct screen *s = &data->screen; char *buf; size_t off; - u_int i, xx, yy, sx, sy, ex, ey; + u_int i, xx, yy, sx, sy, ex, ey, ey_last; u_int firstsx, lastex, restex, restsx; int keys; @@ -1389,9 +1389,9 @@ window_copy_get_selection(struct window_pane *wp, size_t *len) } /* Trim ex to end of line. */ - xx = window_copy_find_length(wp, ey); - if (ex > xx) - ex = xx; + ey_last = window_copy_find_length(wp, ey); + if (ex > ey_last) + ex = ey_last; /* * Deal with rectangle-copy if necessary; four situations: start of @@ -1453,7 +1453,9 @@ window_copy_get_selection(struct window_pane *wp, size_t *len) free(buf); return (NULL); } - *len = off - 1; /* remove final \n */ + if (keys == MODEKEY_EMACS || lastex <= ey_last) + off -= 1; /* remove final \n (unless at end in vi mode) */ + *len = off; return (buf); } |