commit 9a44bbd57410a420b676fdeea6e57290d6298adf
parent dd707246fd83234a938768c4ee84991aae5bef3b
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri, 4 Jul 2025 16:23:19 +0800
vim-patch:9.1.1493: manually comparing positions on buffer
Problem: manually comparing positions on buffer
(after v9.1.1490)
Solution: use the LTOREQ_POS() macro, fix a few other minor style issues
(glepnir)
closes: vim/vim#17629
https://github.com/vim/vim/commit/7cf35bc1bedaa8d364d65aace40997941bf1f0a4
Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat:
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
@@ -3988,14 +3988,8 @@ static int expand_pattern_in_buf(char *pat, Direction dir, char ***matches, int
if (compl_started) {
// If we've looped back to an earlier match, stop
- if ((dir == FORWARD
- && (cur_match_pos.lnum < prev_match_pos.lnum
- || (cur_match_pos.lnum == prev_match_pos.lnum
- && cur_match_pos.col <= prev_match_pos.col)))
- || (dir == BACKWARD
- && (cur_match_pos.lnum > prev_match_pos.lnum
- || (cur_match_pos.lnum == prev_match_pos.lnum
- && cur_match_pos.col >= prev_match_pos.col)))) {
+ if ((dir == FORWARD && ltoreq(cur_match_pos, prev_match_pos))
+ || (dir == BACKWARD && ltoreq(prev_match_pos, cur_match_pos))) {
if (looped_around) {
break;
} else {