From 9a44bbd57410a420b676fdeea6e57290d6298adf Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 4 Jul 2025 16:23:19 +0800 Subject: [PATCH] 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 --- src/nvim/cmdexpand.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index 64ac0f4b64..836d5aa57a 100644 --- 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 {