From 9c4f2cde7bef5decb2de98edfae7b5a2e5146cf4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 6 Mar 2025 08:26:31 +0800 Subject: vim-patch:9.1.1176: wrong indent when expanding multiple lines (#32746) Problem: wrong indentation of lastline when expanding multiple lines Solution: Check OPENLINE_FORCE_INDENT flag in open_line() (glepnir) closes: vim/vim#16786 https://github.com/vim/vim/commit/34a7d82aaed9836174f4ea84af047db3fdf6c8b3 Co-authored-by: glepnir --- test/functional/ui/popupmenu_spec.lua | 16 ++++++++++++++++ test/old/testdir/test_popup.vim | 9 +++++++++ 2 files changed, 25 insertions(+) (limited to 'test') diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 0206900c06..3b52f62464 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -7310,6 +7310,7 @@ describe('builtin popupmenu', function() return [#{word: "func ()\n\t\nend", abbr: "function ()",}, #{word: "foobar"}, #{word: "你好\n\t\n我好"}] endfunc set omnifunc=Omni_test + inoremap call complete(col('.'), [ "my\n\tmulti\nline", "my\n\t\tmulti\nline" ]) ]]) feed('S') @@ -7452,6 +7453,21 @@ describe('builtin popupmenu', function() {1:~ }|*14 {2:-- INSERT --} | ]]) + + feed('ggVGd') + command('filetype indent on') + command('setlocal noautoindent shiftwidth& tabstop&') + command('setlocal ft=lua') + feed('S') + screen:expect([[ + {8:my} | + {8: multi} | + {8:line}^ | + {s:my^@ multi^@line }{1: }| + {n:my^@ multi^@line }{1: }| + {1:~ }|*14 + {2:-- INSERT --} | + ]]) end) end end diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 0b88fd1dba..988d60916c 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1896,6 +1896,7 @@ func Test_pum_complete_with_special_characters() return [#{word: "func ()\n\t\nend", abbr: "function ()",}, #{word: "foobar"}, #{word: "你好\n\t\n我好"}] endfunc set omnifunc=Omni_test + inoremap call complete(col('.'), [ "my\n\tmulti\nline", "my\n\t\tmulti\nline" ]) END call writefile(lines, 'Xpreviewscript', 'D') @@ -1954,6 +1955,14 @@ func Test_pum_complete_with_special_characters() call TermWait(buf, 50) call VerifyScreenDump(buf, 'Test_pum_with_special_characters_12', {}) + call term_sendkeys(buf, "\ggVGd") + call term_sendkeys(buf, ":filetype indent on\") + call term_sendkeys(buf, ":set nocompatible autoindent& shiftwidth& tabstop&\") + call term_sendkeys(buf, ":setlocal ft=lua\") + call term_sendkeys(buf, "S\") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_with_special_characters_13', {}) + call StopVimInTerminal(buf) endfunc -- cgit