diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-10-19 19:20:15 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-10-19 19:20:15 +0000 |
commit | 30ad2d3a01ab6c01c02d98c02557c7c37af276a3 (patch) | |
tree | 5894ae888ffc1ebbd3c112ec43da3a151a1bfa20 /usr.bin/tmux | |
parent | ac9a301cbcb87502a7a364713a46642b3223df08 (diff) |
Add formats for cursor and selection position in copy mode, from Jason Felice.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/tmux.1 | 10 | ||||
-rw-r--r-- | usr.bin/tmux/window-copy.c | 14 |
2 files changed, 20 insertions, 4 deletions
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 8f360663c60..1e9163000aa 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.690 2019/10/15 08:25:37 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.691 2019/10/19 19:20:14 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: October 15 2019 $ +.Dd $Mdocdate: October 19 2019 $ .Dt TMUX 1 .Os .Sh NAME @@ -4214,6 +4214,8 @@ The following variables are available, where appropriate: .It Li "command_list_alias" Ta "" Ta "Command alias if listing commands" .It Li "command_list_name" Ta "" Ta "Command name if listing commands" .It Li "command_list_usage" Ta "" Ta "Command usage if listing commands" +.It Li "copy_cursor_x" Ta "" Ta "Cursor X position in copy mode" +.It Li "copy_cursor_y" Ta "" Ta "Cursor Y position in copy mode" .It Li "cursor_character" Ta "" Ta "Character at cursor in pane" .It Li "cursor_flag" Ta "" Ta "Pane cursor flag" .It Li "cursor_x" Ta "" Ta "Cursor X position in pane" @@ -4279,7 +4281,11 @@ The following variables are available, where appropriate: .It Li "scroll_position" Ta "" Ta "Scroll position in copy mode" .It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane" .It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane" +.It Li "selection_end_x" Ta "" Ta "X position of the end of the selection" +.It Li "selection_end_y" Ta "" Ta "Y position of the end of the selection" .It Li "selection_present" Ta "" Ta "1 if selection started in copy mode" +.It Li "selection_start_x" Ta "" Ta "X position of the start of the selection" +.It Li "selection_start_y" Ta "" Ta "Y position of the start of the selection" .It Li "session_activity" Ta "" Ta "Time of session last activity" .It Li "session_alerts" Ta "" Ta "List of window indexes with alerts" .It Li "session_attached" Ta "" Ta "Number of clients session is attached to" diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index ed3550849ff..16314f1f05e 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.235 2019/09/10 07:50:33 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.236 2019/10/19 19:20:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -565,9 +565,19 @@ window_copy_formats(struct window_mode_entry *wme, struct format_tree *ft) { struct window_copy_mode_data *data = wme->data; - format_add(ft, "selection_present", "%d", data->screen.sel != NULL); format_add(ft, "scroll_position", "%d", data->oy); format_add(ft, "rectangle_toggle", "%d", data->rectflag); + + format_add(ft, "copy_cursor_x", "%d", data->cx); + format_add(ft, "copy_cursor_y", "%d", data->cy); + + format_add(ft, "selection_present", "%d", data->screen.sel != NULL); + if (data->screen.sel != NULL) { + format_add(ft, "selection_start_x", "%d", data->selx); + format_add(ft, "selection_start_y", "%d", data->sely); + format_add(ft, "selection_end_x", "%d", data->endselx); + format_add(ft, "selection_end_y", "%d", data->endsely); + } } static void |