summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2019-10-19 19:20:14 +0000
committernicm <nicm>2019-10-19 19:20:14 +0000
commit56e5067c462a8c03fd35fbd5833c5fe17c23b0fa (patch)
treed1ddd3b272e7d442b3b12205eb8bba205813bece
parent2cb268d51b71d74cf32e9cd1f67892681a9563e1 (diff)
Add formats for cursor and selection position in copy mode, from Jason Felice.
-rw-r--r--tmux.16
-rw-r--r--window-copy.c12
2 files changed, 17 insertions, 1 deletions
diff --git a/tmux.1 b/tmux.1
index 9405a11a..9d392a90 100644
--- a/tmux.1
+++ b/tmux.1
@@ -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/window-copy.c b/window-copy.c
index 76736ab2..bca236e3 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -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