Applied to OpenBSD now, will be in GitHub later on, thanks!
On Thu, Aug 08, 2019 at 02:30:46PM +0200, Leah Neukirchen wrote: > This behaves similarily to POSIX vi and gives a nice way to reverse > search direction for search-again. > > Also allow these commands to be called without argument now. > > Signed-off-by: Leah Neukirchen <l...@vuxu.org> > --- > window-copy.c | 28 ++++++++++++++++++---------- > 1 file changed, 18 insertions(+), 10 deletions(-) > > diff --git a/window-copy.c b/window-copy.c > index 5b197e65..ecd7f89e 100644 > --- a/window-copy.c > +++ b/window-copy.c > @@ -1635,12 +1635,16 @@ window_copy_cmd_search_backward(struct > window_copy_cmd_state *cs) > struct window_mode_entry *wme = cs->wme; > struct window_copy_mode_data *data = wme->data; > u_int np = wme->prefix; > - const char *argument = cs->args->argv[1]; > > - if (*argument != '\0') { > + if (cs->args->argc == 2) { > + const char *argument = cs->args->argv[1]; > + if (*argument != '\0') { > + free(data->searchstr); > + data->searchstr = xstrdup(argument); > + } > + } > + if (data->searchstr) { > data->searchtype = WINDOW_COPY_SEARCHUP; > - free(data->searchstr); > - data->searchstr = xstrdup(argument); > for (; np != 0; np--) > window_copy_search_up(wme); > } > @@ -1653,12 +1657,16 @@ window_copy_cmd_search_forward(struct > window_copy_cmd_state *cs) > struct window_mode_entry *wme = cs->wme; > struct window_copy_mode_data *data = wme->data; > u_int np = wme->prefix; > - const char *argument = cs->args->argv[1]; > > - if (*argument != '\0') { > + if (cs->args->argc == 2) { > + const char *argument = cs->args->argv[1]; > + if (*argument != '\0') { > + free(data->searchstr); > + data->searchstr = xstrdup(argument); > + } > + } > + if (data->searchstr) { > data->searchtype = WINDOW_COPY_SEARCHDOWN; > - free(data->searchstr); > - data->searchstr = xstrdup(argument); > for (; np != 0; np--) > window_copy_search_down(wme); > } > @@ -1872,11 +1880,11 @@ static const struct { > window_copy_cmd_scroll_up }, > { "search-again", 0, 0, > window_copy_cmd_search_again }, > - { "search-backward", 1, 1, > + { "search-backward", 0, 1, > window_copy_cmd_search_backward }, > { "search-backward-incremental", 1, 1, > window_copy_cmd_search_backward_incremental }, > - { "search-forward", 1, 1, > + { "search-forward", 0, 1, > window_copy_cmd_search_forward }, > { "search-forward-incremental", 1, 1, > window_copy_cmd_search_forward_incremental }, > -- > 2.22.0 > > -- > 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 tmux-users+unsubscr...@googlegroups.com. > To view this discussion on the web, visit > https://groups.google.com/d/msgid/tmux-users/20190808123046.27250-1-leah%40vuxu.org. -- 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 tmux-users+unsubscr...@googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/20190814100243.gai36m6pioq6icrw%40yelena.