From: Jeff King Date: Tue, 3 Feb 2009 05:49:08 +0000 (-0500) Subject: Treat empty '/' as "find next" X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0b2667708c086c0b302d03f4143c6bd31c6144af;p=tig.git 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 --- 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;