← Commit list

08ad934ac

Ron Yorston
Ron Yorston
2021-08-22
SUCCESS Duration: 152s

Subject

vi: searches in colon commands should wrap

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

editors/vi.c+7 -2
@@ -2527,8 +2527,13 @@ static char *get_one_address(char *p, int *result) // get colon addr, if present
dir = ((unsigned)BACK << 1) | FULL;
}
q = char_search(q, last_search_pattern + 1, dir);
- if (q == NULL)
- return NULL;
+ if (q == NULL) {
+ // no match, continue from other end of file
+ q = char_search(dir > 0 ? text : end - 1,
+ last_search_pattern + 1, dir);
+ if (q == NULL)
+ return NULL;
+ }
new_addr = count_lines(text, q);
}
# endif