diff options
-rw-r--r-- | miscutils/less.c | 14 |
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) | |||
845 | free(err); | 845 | free(err); |
846 | return; | 846 | return; |
847 | } | 847 | } |
848 | |||
848 | pattern_valid = 1; | 849 | pattern_valid = 1; |
849 | match_pos = 0; | 850 | match_pos = 0; |
850 | |||
851 | fill_match_lines(0); | 851 | fill_match_lines(0); |
852 | |||
853 | if (num_matches == 0 || max_fline <= max_displayed_line) { | ||
854 | buffer_print(); | ||
855 | return; | ||
856 | } | ||
857 | while (match_pos < num_matches) { | 852 | while (match_pos < num_matches) { |
858 | if (match_lines[match_pos] > cur_fline) | 853 | if (match_lines[match_pos] > cur_fline) |
859 | break; | 854 | break; |
@@ -861,8 +856,11 @@ static void regex_process(void) | |||
861 | } | 856 | } |
862 | if (option_mask32 & LESS_STATE_MATCH_BACKWARDS) | 857 | if (option_mask32 & LESS_STATE_MATCH_BACKWARDS) |
863 | match_pos--; | 858 | match_pos--; |
864 | normalize_match_pos(match_pos); | 859 | |
865 | buffer_line(match_lines[match_pos]); | 860 | /* It's possible that no matches are found yet. |
861 | * goto_match() will read input looking for match, | ||
862 | * if needed */ | ||
863 | goto_match(match_pos); | ||
866 | } | 864 | } |
867 | #endif | 865 | #endif |
868 | 866 | ||