From 0b2667708c086c0b302d03f4143c6bd31c6144af Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 3 Feb 2009 00:49:08 -0500 Subject: [PATCH] Treat empty '/' as "find next" When the user requests a forward or backwards search, if they provide no search string then we just abort the search. However, many other programs (such as less and vi) treat this as "repeat the last search", so users may have their fingers trained to do this rather than use the explicit "find next" feature. This patch causes tig, if there was a previous search, to find the next (or previous, if "?" was used) match in such a case. Signed-off-by: Jeff King Signed-off-by: Jonas Fonseca --- tig.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tig.c b/tig.c index c8ae053..53b2fdb 100644 --- a/tig.c +++ b/tig.c @@ -6831,6 +6831,10 @@ main(int argc, const char *argv[]) if (search) string_ncopy(opt_search, search, strlen(search)); + else if (*opt_search) + request = request == REQ_SEARCH ? + REQ_FIND_NEXT : + REQ_FIND_PREV; else request = REQ_NONE; break; -- 2.32.0.93.g670b81a890