Try this and #{pane_search_string}:
diff --git a/format.c b/format.c
index 6b5b4df8..b9b1103b 100644
--- a/format.c
+++ b/format.c
@@ -1322,6 +1322,8 @@ format_defaults_pane(struct format_tree *ft, struct
window_pane *wp)
format_add(ft, "pane_in_mode", "%d", wp->screen != &wp->base);
format_add(ft, "pane_synchronized", "%d",
!!options_get_number(wp->window->options, "synchronize-panes"));
+ format_add(ft, "pane_search_string", "%s",
+ window_copy_search_string(wp));
format_add(ft, "pane_tty", "%s", wp->tty);
format_add(ft, "pane_pid", "%ld", (long) wp->pid);
diff --git a/tmux.1 b/tmux.1
index cb069e5e..8436d810 100644
--- a/tmux.1
+++ b/tmux.1
@@ -3568,6 +3568,7 @@ The following variables are available, where appropriate:
.It Li "pane_left" Ta "" Ta "Left of pane"
.It Li "pane_pid" Ta "" Ta "PID of first process in pane"
.It Li "pane_right" Ta "" Ta "Right of pane"
+.It Li "pane_search_string" Ta "" Ta "Last search string in copy mode"
.It Li "pane_start_command" Ta "" Ta "Command pane started with"
.It Li "pane_synchronized" Ta "" Ta "If pane is synchronized"
.It Li "pane_tabs" Ta "" Ta "Pane tab positions"
diff --git a/tmux.h b/tmux.h
index 453c3511..ca1b0f5e 100644
--- a/tmux.h
+++ b/tmux.h
@@ -2171,6 +2171,7 @@ void window_copy_vadd(struct window_pane *,
const char *, va_list);
void window_copy_pageup(struct window_pane *, int);
void window_copy_start_drag(struct client *, struct mouse_event *);
int window_copy_scroll_position(struct window_pane *);
+const char *window_copy_search_string(struct window_pane *);
/* window-choose.c */
extern const struct window_mode window_choose_mode;
diff --git a/window-copy.c b/window-copy.c
index 0896479a..7def63db 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -2480,3 +2480,16 @@ window_copy_drag_update(__unused struct client *c,
struct mouse_event *m)
if (window_copy_update_selection(wp, 1))
window_copy_redraw_selection(wp, old_cy);
}
+
+const char *
+window_copy_search_string(struct window_pane *wp)
+{
+ struct window_copy_mode_data *data;
+
+ if (wp->mode != &window_copy_mode)
+ return ("");
+ data = wp->modedata;
+ if (data->searchtype == WINDOW_COPY_OFF || data->searchstr == NULL)
+ return ("");
+ return (data->searchstr);
+}
--
You received this message because you are subscribed to the Google Groups
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.