summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 43ef4ce)
raw | patch | inline | side by side (parent: 43ef4ce)
author | Jeff King <peff@peff.net> | |
Tue, 3 Feb 2009 05:49:08 +0000 (00:49 -0500) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 3 Feb 2009 14:27:30 +0000 (15:27 +0100) |
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 <peff@peff.net>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
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 <peff@peff.net>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
tig.c | patch | blob | history |
index c8ae05395c875397fef7be41c9ebf4ac5473af62..53b2fdbf3dff95872a09c1e17dbc0ba0702ba1bd 100644 (file)
--- a/tig.c
+++ b/tig.c
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;