summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2021-03-09 13:07:50 +0000
committernicm <nicm@openbsd.org>2021-03-09 13:07:50 +0000
commitc2e97d3e75f853202882c1681e0dbaaa32581498 (patch)
tree02633c768d21b2987c941e5a915848b892d16a6f
parentCopy mode improvements from Anindya Mukherjee: (diff)
downloadwireguard-openbsd-c2e97d3e75f853202882c1681e0dbaaa32581498.tar.xz
wireguard-openbsd-c2e97d3e75f853202882c1681e0dbaaa32581498.zip
Allow cursor to be just after match if copying, GitHub issue 2602.
-rw-r--r--usr.bin/tmux/window-copy.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index cbb2f8d1288..764973cfb33 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.319 2021/03/09 08:24:09 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.320 2021/03/09 13:07:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -3366,8 +3366,11 @@ window_copy_match_at_cursor(struct window_copy_mode_data *data)
cy = screen_hsize(data->backing) - data->oy + data->cy;
if (window_copy_search_mark_at(data, data->cx, cy, &at) != 0)
return (NULL);
- if (data->searchmark[at] == 0)
- return (NULL);
+ if (data->searchmark[at] == 0) {
+ /* Allow one position after the match. */
+ if (at == 0 || data->searchmark[--at] == 0)
+ return (NULL);
+ }
window_copy_match_start_end(data, at, &start, &end);
/*