patch 9.1.1493: manually comparing positions on buffer

Commit: 
https://github.com/vim/vim/commit/7cf35bc1bedaa8d364d65aace40997941bf1f0a4
Author: glepnir <glephun...@gmail.com>
Date:   Sun Jun 29 16:51:40 2025 +0200

    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: #17629
    
    Signed-off-by: glepnir <glephun...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index 4615aafac..3ff6bd40a 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -4560,15 +4560,17 @@ copy_substring_from_pos(pos_T *start, pos_T *end, 
char_u **match,
     int            is_single_line = start->lnum == end->lnum;
 
     segment_len = is_single_line ? (end->col - start->col)
-       : (int)STRLEN(start_ptr);
+                               : (int)STRLEN(start_ptr);
     if (ga_grow(&ga, segment_len + 1) != OK)
        return FAIL;
+
     ga_concat_len(&ga, start_ptr, segment_len);
     if (!is_single_line)
        ga_append(&ga, '
');
 
     // Append full lines between start and end
     if (!is_single_line)
+    {
        for (lnum = start->lnum + 1; lnum < end->lnum; lnum++)
        {
            line = ml_get(lnum);
@@ -4577,6 +4579,7 @@ copy_substring_from_pos(pos_T *start, pos_T *end, char_u 
**match,
            ga_concat(&ga, line);
            ga_append(&ga, '
');
        }
+    }
 
     // Append partial end line (up to word end)
     word_end = find_word_end(end_line + end->col);
@@ -4616,7 +4619,7 @@ expand_pattern_in_buf(
     int                pat_len, match_len;
     int                has_range = FALSE;
     int                compl_started = FALSE;
-    int                search_flags, i;
+    int                search_flags;
     char_u     *match, *line, *word_end;
     regmatch_T regmatch;
 
@@ -4673,14 +4676,8 @@ expand_pattern_in_buf(
        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_POS(cur_match_pos, prev_match_pos)) ||
+               (dir == BACKWARD && LTOREQ_POS(prev_match_pos, cur_match_pos)))
            {
                if (looped_around)
                    break;
@@ -4740,7 +4737,7 @@ expand_pattern_in_buf(
        match[pat_len + match_len] = NUL;
 
        // Include this match if it is not a duplicate
-       for (i = 0; i < ga.ga_len; ++i)
+       for (int i = 0; i < ga.ga_len; ++i)
        {
            if (STRCMP(match, ((char_u **)ga.ga_data)[i]) == 0)
            {
diff --git a/src/version.c b/src/version.c
index e19d10ab8..90d999acb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1493,
 /**/
     1492,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uVtVj-00AbuM-PT%40256bit.org.

Raspunde prin e-mail lui