Hi

This will only work if you do search-forward '', it would be more useful
to also work without arguments (change window_copy_cmd_table and add an
argc check as well).



On Thu, Aug 08, 2019 at 01:45:07PM +0200, Leah Neukirchen wrote:
> This behaves similarily to POSIX vi and gives a nice way to reverse
> search direction for search-again.
> 
> Signed-off-by: Leah Neukirchen <[email protected]>
> ---
>  window-copy.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/window-copy.c b/window-copy.c
> index 5b197e65..99bb5be6 100644
> --- a/window-copy.c
> +++ b/window-copy.c
> @@ -1638,9 +1638,11 @@ window_copy_cmd_search_backward(struct 
> window_copy_cmd_state *cs)
>       const char                      *argument = cs->args->argv[1];
>  
>       if (*argument != '\0') {
> -             data->searchtype = WINDOW_COPY_SEARCHUP;
>               free(data->searchstr);
>               data->searchstr = xstrdup(argument);
> +     }
> +     if (data->searchstr) {
> +             data->searchtype = WINDOW_COPY_SEARCHUP;
>               for (; np != 0; np--)
>                       window_copy_search_up(wme);
>       }
> @@ -1656,9 +1658,11 @@ window_copy_cmd_search_forward(struct 
> window_copy_cmd_state *cs)
>       const char                      *argument = cs->args->argv[1];
>  
>       if (*argument != '\0') {
> -             data->searchtype = WINDOW_COPY_SEARCHDOWN;
>               free(data->searchstr);
>               data->searchstr = xstrdup(argument);
> +     }
> +     if (data->searchstr) {
> +             data->searchtype = WINDOW_COPY_SEARCHDOWN;
>               for (; np != 0; np--)
>                       window_copy_search_down(wme);
>       }
> -- 
> 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 [email protected].
> To view this discussion on the web, visit 
> https://groups.google.com/d/msgid/tmux-users/20190808114507.14835-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 [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/tmux-users/20190808120355.hrjkncqnsudl7awl%40yelena.

Reply via email to