aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-08 18:12:01 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-08 18:12:01 +0000
commita1c631278bce9da92a4e8628a946e0e91cf2e2b5 (patch)
tree98e8ea974f24146827e6ff7cc2106f0b59c6d967
parent18d6fc1a506dfe717cb5de433870dd6eca46270b (diff)
downloadbusybox-a1c631278bce9da92a4e8628a946e0e91cf2e2b5.tar.gz
less: make '/' (regex search) scan input if no matches are found
in input taken so far.
-rw-r--r--miscutils/less.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/miscutils/less.c b/miscutils/less.c
index 207f5864e..31055a6c7 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -845,15 +845,10 @@ static void regex_process(void)
free(err);
return;
}
+
pattern_valid = 1;
match_pos = 0;
-
fill_match_lines(0);
-
- if (num_matches == 0 || max_fline <= max_displayed_line) {
- buffer_print();
- return;
- }
while (match_pos < num_matches) {
if (match_lines[match_pos] > cur_fline)
break;
@@ -861,8 +856,11 @@ static void regex_process(void)
}
if (option_mask32 & LESS_STATE_MATCH_BACKWARDS)
match_pos--;
- normalize_match_pos(match_pos);
- buffer_line(match_lines[match_pos]);
+
+ /* It's possible that no matches are found yet.
+ * goto_match() will read input looking for match,
+ * if needed */
+ goto_match(match_pos);
}
#endif