aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/vi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 508477954..eee5e0ed2 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2527,8 +2527,13 @@ static char *get_one_address(char *p, int *result) // get colon addr, if present
2527 dir = ((unsigned)BACK << 1) | FULL; 2527 dir = ((unsigned)BACK << 1) | FULL;
2528 } 2528 }
2529 q = char_search(q, last_search_pattern + 1, dir); 2529 q = char_search(q, last_search_pattern + 1, dir);
2530 if (q == NULL) 2530 if (q == NULL) {
2531 return NULL; 2531 // no match, continue from other end of file
2532 q = char_search(dir > 0 ? text : end - 1,
2533 last_search_pattern + 1, dir);
2534 if (q == NULL)
2535 return NULL;
2536 }
2532 new_addr = count_lines(text, q); 2537 new_addr = count_lines(text, q);
2533 } 2538 }
2534# endif 2539# endif