patch 9.1.1132: Mark positions wrong after triggering multiline completion

Commit: 
https://github.com/vim/vim/commit/060e6556e2cd97512cee1f46bc7915768c0f9e21
Author: zeertzjq <zeert...@outlook.com>
Date:   Fri Feb 21 20:06:26 2025 +0100

    patch 9.1.1132: Mark positions wrong after triggering multiline completion
    
    Problem:  Mark positions wrong after triggering multiline completion.
    Solution: Call deleted_lines_mark() after deleting lines.
              (zeertzjq)
    
    closes: #16687
    
    Co-authored-by: Sean Dewar <6256228+seande...@users.noreply.github.com>
    Signed-off-by: zeertzjq <zeert...@outlook.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/insexpand.c b/src/insexpand.c
index 624165a9b..dc8c76bee 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -4429,6 +4429,7 @@ ins_compl_delete(void)
                    VIM_CLEAR(remaining);
                return;
            }
+           deleted_lines_mark(curwin->w_cursor.lnum, 1L);
            curwin->w_cursor.lnum--;
        }
        // move cursor to end of line
diff --git a/src/testdir/test_ins_complete.vim 
b/src/testdir/test_ins_complete.vim
index 0b943712b..c34f6426e 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -3182,4 +3182,48 @@ function Test_completeopt_preinsert()
   delfunc Omni_test
 endfunc
 
+" Check that mark positions are correct after triggering multiline completion.
+func Test_complete_multiline_marks()
+  func Omni_test(findstart, base)
+    if a:findstart
+      return col(".")
+    endif
+    return [
+          \ #{word: "func ()
        
end"},
+          \ #{word: "foobar"},
+          \ #{word: "你好
        
我好"}
+          \ ]
+  endfunc
+  set omnifunc=Omni_test
+
+  new
+  let lines = mapnew(range(10), 'string(v:val)')
+  call setline(1, lines)
+  call setpos("'a", [0, 3, 1, 0])
+
+  call feedkeys("A \<C-X>\<C-O>\<C-E>\<BS>", 'tx')
+  call assert_equal(lines, getline(1, '$'))
+  call assert_equal([0, 3, 1, 0], getpos("'a"))
+
+  call feedkeys("A \<C-X>\<C-O>\<C-N>\<C-E>\<BS>", 'tx')
+  call assert_equal(lines, getline(1, '$'))
+  call assert_equal([0, 3, 1, 0], getpos("'a"))
+
+  call feedkeys("A \<C-X>\<C-O>\<C-N>\<C-N>\<C-E>\<BS>", 'tx')
+  call assert_equal(lines, getline(1, '$'))
+  call assert_equal([0, 3, 1, 0], getpos("'a"))
+
+  call feedkeys("A \<C-X>\<C-O>\<C-N>\<C-N>\<C-N>\<C-E>\<BS>", 'tx')
+  call assert_equal(lines, getline(1, '$'))
+  call assert_equal([0, 3, 1, 0], getpos("'a"))
+
+  call feedkeys("A \<C-X>\<C-O>\<C-Y>", 'tx')
+  call assert_equal(['0 func ()', "    ", 'end'] + lines[1:], getline(1, '$'))
+  call assert_equal([0, 5, 1, 0], getpos("'a"))
+
+  bw!
+  set omnifunc&
+  delfunc Omni_test
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab nofoldenable
diff --git a/src/version.c b/src/version.c
index 8e338f75f..d09ba285c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1132,
 /**/
     1131,
 /**/

-- 
-- 
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/E1tlYUK-004xVr-LF%40256bit.org.

Raspunde prin e-mail lui