diff options
| author | 2017-05-12 10:45:38 +0000 | |
|---|---|---|
| committer | 2017-05-12 10:45:38 +0000 | |
| commit | 4f67ae45b74899ff69c22184476357ad2ed23de9 (patch) | |
| tree | 3256aee90cdd4aa4f803683d767dcf9380bb71b2 /usr.bin/tmux/window-copy.c | |
| parent | Introduce a new keyboard console hook to enter ddb(4) and make ukbd(4) (diff) | |
| download | wireguard-openbsd-4f67ae45b74899ff69c22184476357ad2ed23de9.tar.xz wireguard-openbsd-4f67ae45b74899ff69c22184476357ad2ed23de9.zip | |
Store copy mode search string in pane so search-again command works even
if you exit and reenter copy mode (it doesn't remember the position,
just the search string), suggested by espie@.
Diffstat (limited to 'usr.bin/tmux/window-copy.c')
| -rw-r--r-- | usr.bin/tmux/window-copy.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index beecbb36f5f..1d84314cf4a 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.173 2017/05/07 22:27:57 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.174 2017/05/12 10:45:38 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -208,8 +208,13 @@ window_copy_init(struct window_pane *wp) data->rectflag = 0; data->scroll_exit = 0; - data->searchtype = WINDOW_COPY_OFF; - data->searchstr = NULL; + if (wp->searchstr != NULL) { + data->searchtype = WINDOW_COPY_SEARCHUP; + data->searchstr = xstrdup(wp->searchstr); + } else { + data->searchtype = WINDOW_COPY_OFF; + data->searchstr = NULL; + } data->searchmark = NULL; data->searchx = data->searchy = data->searcho = -1; @@ -1134,6 +1139,9 @@ window_copy_search(struct window_pane *wp, int direction, int moveflag) u_int fx, fy, endline; int wrapflag, cis, found; + free(wp->searchstr); + wp->searchstr = xstrdup(data->searchstr); + fx = data->cx; fy = screen_hsize(data->backing) - data->oy + data->cy; @@ -2482,16 +2490,3 @@ 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); -} |
