diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-14 20:50:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-14 20:50:53 +0800 |
commit | d549734fb4792bcdb5395006538f7c6d856252e7 (patch) | |
tree | df8dff752a66b45605d72502a04e61718e1e391c | |
parent | bf0839044254482e02cc5e05b07e0b465a47e1e4 (diff) | |
parent | d98e4e4b2ecd84162635a5f354dc4ddc6a49abc5 (diff) | |
download | rneovim-d549734fb4792bcdb5395006538f7c6d856252e7.tar.gz rneovim-d549734fb4792bcdb5395006538f7c6d856252e7.tar.bz2 rneovim-d549734fb4792bcdb5395006538f7c6d856252e7.zip |
Merge pull request #21795 from zeertzjq/vim-8.2.4346
vim-patch:8.2.{4346,4382,4391},9.0.1195
N/A patches for version.c:
vim-patch:9.0.1197: dump file missing from patch
Problem: Dump file missing from patch.
Solution: Add missing dump file.
https://github.com/vim/vim/commit/034c350207931a7ff57c76536d4703f6da595919
-rw-r--r-- | src/nvim/statusline.c | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_cmdline.vim | 30 | ||||
-rw-r--r-- | src/nvim/testdir/test_statusline.vim | 27 | ||||
-rw-r--r-- | src/nvim/testdir/test_tabline.vim | 26 | ||||
-rw-r--r-- | src/nvim/testdir/test_window_cmd.vim | 6 | ||||
-rw-r--r-- | test/functional/legacy/statusline_spec.lua | 38 | ||||
-rw-r--r-- | test/functional/legacy/tabline_spec.lua | 51 |
7 files changed, 173 insertions, 9 deletions
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index 7647c1fcfb..db3e3f91bf 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -944,6 +944,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n char *usefmt = fmt; const int save_must_redraw = must_redraw; const int save_redr_type = curwin->w_redr_type; + const bool save_KeyTyped = KeyTyped; // TODO(Bram): find out why using called_emsg_before makes tests fail, does it // matter? // const int called_emsg_before = called_emsg; @@ -2149,5 +2150,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n set_string_option_direct(opt_name, -1, "", OPT_FREE | opt_scope, SID_ERROR); } + // A user function may reset KeyTyped, restore it. + KeyTyped = save_KeyTyped; + return width; } diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 2f4048cc33..8fc6e9847d 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -2304,6 +2304,23 @@ func Test_wildmenu_pum() return repeat(['aaaa'], 120) endfunc command -nargs=* -complete=customlist,CmdCompl Tcmd + + func MyStatusLine() abort + return 'status' + endfunc + func SetupStatusline() + set statusline=%!MyStatusLine() + set laststatus=2 + endfunc + + func MyTabLine() + return 'my tab line' + endfunc + func SetupTabline() + set statusline= + set tabline=%!MyTabLine() + set showtabline=2 + endfunc [CODE] call writefile(commands, 'Xtest') @@ -2487,6 +2504,19 @@ func Test_wildmenu_pum() call term_sendkeys(buf, ":ls\<CR>") call term_sendkeys(buf, ":com\<Tab> ") call VerifyScreenDump(buf, 'Test_wildmenu_pum_38', {}) + call term_sendkeys(buf, "\<C-U>\<CR>") + + " Esc still works to abort the command when 'statusline' is set + call term_sendkeys(buf, ":call SetupStatusline()\<CR>") + call term_sendkeys(buf, ":si\<Tab>") + call term_sendkeys(buf, "\<Esc>") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_39', {}) + + " Esc still works to abort the command when 'tabline' is set + call term_sendkeys(buf, ":call SetupTabline()\<CR>") + call term_sendkeys(buf, ":si\<Tab>") + call term_sendkeys(buf, "\<Esc>") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_40', {}) call term_sendkeys(buf, "\<C-U>\<CR>") call StopVimInTerminal(buf) diff --git a/src/nvim/testdir/test_statusline.vim b/src/nvim/testdir/test_statusline.vim index 25ab1cf518..990c852ccd 100644 --- a/src/nvim/testdir/test_statusline.vim +++ b/src/nvim/testdir/test_statusline.vim @@ -569,22 +569,41 @@ func Test_statusline_showcmd() CheckScreendump let lines =<< trim END + func MyStatusLine() + return '%S' + endfunc + set laststatus=2 - set statusline=%S + set statusline=%!MyStatusLine() set showcmdloc=statusline call setline(1, ['a', 'b', 'c']) + set foldopen+=jump + 1,2fold + 3 END call writefile(lines, 'XTest_statusline', 'D') let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 6}) - call feedkeys("\<C-V>Gl", "xt") + + call term_sendkeys(buf, "g") call VerifyScreenDump(buf, 'Test_statusline_showcmd_1', {}) - call feedkeys("\<Esc>1234", "xt") + " typing "gg" should open the fold + call term_sendkeys(buf, "g") call VerifyScreenDump(buf, 'Test_statusline_showcmd_2', {}) - call feedkeys("\<Esc>:set statusline=\<CR>:\<CR>1234", "xt") + call term_sendkeys(buf, "\<C-V>Gl") call VerifyScreenDump(buf, 'Test_statusline_showcmd_3', {}) + + call term_sendkeys(buf, "\<Esc>1234") + call VerifyScreenDump(buf, 'Test_statusline_showcmd_4', {}) + + call term_sendkeys(buf, "\<Esc>:set statusline=\<CR>") + call term_sendkeys(buf, ":\<CR>") + call term_sendkeys(buf, "1234") + call VerifyScreenDump(buf, 'Test_statusline_showcmd_5', {}) + + call StopVimInTerminal(buf) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_tabline.vim b/src/nvim/testdir/test_tabline.vim index 20a9657f32..d9bef09067 100644 --- a/src/nvim/testdir/test_tabline.vim +++ b/src/nvim/testdir/test_tabline.vim @@ -167,19 +167,41 @@ func Test_tabline_showcmd() CheckScreendump let lines =<< trim END + func MyTabLine() + return '%S' + endfunc + set showtabline=2 + set tabline=%!MyTabLine() set showcmdloc=tabline call setline(1, ['a', 'b', 'c']) + set foldopen+=jump + 1,2fold + 3 END call writefile(lines, 'XTest_tabline', 'D') let buf = RunVimInTerminal('-S XTest_tabline', {'rows': 6}) - call feedkeys("\<C-V>Gl", "xt") + call term_sendkeys(buf, "g") call VerifyScreenDump(buf, 'Test_tabline_showcmd_1', {}) - call feedkeys("\<Esc>1234", "xt") + " typing "gg" should open the fold + call term_sendkeys(buf, "g") call VerifyScreenDump(buf, 'Test_tabline_showcmd_2', {}) + + call term_sendkeys(buf, "\<C-V>Gl") + call VerifyScreenDump(buf, 'Test_tabline_showcmd_3', {}) + + call term_sendkeys(buf, "\<Esc>1234") + call VerifyScreenDump(buf, 'Test_tabline_showcmd_4', {}) + + call term_sendkeys(buf, "\<Esc>:set tabline=\<CR>") + call term_sendkeys(buf, ":\<CR>") + call term_sendkeys(buf, "1234") + call VerifyScreenDump(buf, 'Test_tabline_showcmd_5', {}) + + call StopVimInTerminal(buf) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index ab63506d3c..c25b1f1157 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -1761,6 +1761,8 @@ function Test_splitkeep_callback() call term_sendkeys(buf, ":quit\<CR>Gt") call VerifyScreenDump(buf, 'Test_splitkeep_callback_4', {}) + + call StopVimInTerminal(buf) endfunc function Test_splitkeep_fold() @@ -1791,6 +1793,8 @@ function Test_splitkeep_fold() call term_sendkeys(buf, ":wincmd k\<CR>:quit\<CR>") call VerifyScreenDump(buf, 'Test_splitkeep_fold_4', {}) + + call StopVimInTerminal(buf) endfunction function Test_splitkeep_status() @@ -1809,6 +1813,8 @@ function Test_splitkeep_status() call term_sendkeys(buf, ":call win_move_statusline(win, 1)\<CR>") call VerifyScreenDump(buf, 'Test_splitkeep_status_1', {}) + + call StopVimInTerminal(buf) endfunction function Test_new_help_window_on_error() diff --git a/test/functional/legacy/statusline_spec.lua b/test/functional/legacy/statusline_spec.lua index 056209154e..c5b17f8749 100644 --- a/test/functional/legacy/statusline_spec.lua +++ b/test/functional/legacy/statusline_spec.lua @@ -76,14 +76,46 @@ describe('statusline', function() [1] = {background = Screen.colors.LightGrey}, -- Visual [2] = {bold = true}, -- MoreMsg [3] = {bold = true, reverse = true}, -- StatusLine + [5] = {background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue}, -- Folded }) exec([[ + func MyStatusLine() + return '%S' + endfunc + set showcmd set laststatus=2 set statusline=%S set showcmdloc=statusline call setline(1, ['a', 'b', 'c']) + set foldopen+=jump + 1,2fold + 3 + ]]) + + feed('g') + screen:expect([[ + {5:+-- 2 lines: a···································}| + ^c | + {0:~ }| + {0:~ }| + {0:~ }| + {3:g }| + | ]]) + + -- typing "gg" should open the fold + feed('g') + screen:expect([[ + ^a | + b | + c | + {0:~ }| + {0:~ }| + {3: }| + | + ]]) + feed('<C-V>Gl') screen:expect([[ {1:a} | @@ -94,6 +126,7 @@ describe('statusline', function() {3:3x2 }| {2:-- VISUAL BLOCK --} | ]]) + feed('<Esc>1234') screen:expect([[ a | @@ -104,7 +137,10 @@ describe('statusline', function() {3:1234 }| | ]]) - feed('<Esc>:set statusline=<CR>:<CR>1234') + + feed('<Esc>:set statusline=<CR>') + feed(':<CR>') + feed('1234') screen:expect([[ a | b | diff --git a/test/functional/legacy/tabline_spec.lua b/test/functional/legacy/tabline_spec.lua index d858f137c5..6b368d1857 100644 --- a/test/functional/legacy/tabline_spec.lua +++ b/test/functional/legacy/tabline_spec.lua @@ -22,16 +22,49 @@ describe('tabline', function() [2] = {bold = true}, -- MoreMsg, TabLineSel [3] = {reverse = true}, -- TabLineFill [4] = {background = Screen.colors.LightGrey, underline = true}, -- TabLine + [5] = {background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue}, -- Folded }) exec([[ + func MyTabLine() + return '%S' + endfunc + set showcmd set showtabline=2 + set tabline=%!MyTabLine() set showcmdloc=tabline call setline(1, ['a', 'b', 'c']) + set foldopen+=jump + 1,2fold + 3 + ]]) + + feed('g') + screen:expect([[ + {3:g }| + {5:+-- 2 lines: a···································}| + ^c | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + + -- typing "gg" should open the fold + feed('g') + screen:expect([[ + {3: }| + ^a | + b | + c | + {0:~ }| + {0:~ }| + | ]]) + feed('<C-V>Gl') screen:expect([[ - {2: + [No Name] }{3: }{4:3x2}{3: }| + {3:3x2 }| {1:a} | {1:b} | {1:c}^ | @@ -39,9 +72,10 @@ describe('tabline', function() {0:~ }| {2:-- VISUAL BLOCK --} | ]]) + feed('<Esc>1234') screen:expect([[ - {2: + [No Name] }{3: }{4:1234}{3: }| + {3:1234 }| a | b | ^c | @@ -49,5 +83,18 @@ describe('tabline', function() {0:~ }| | ]]) + + feed('<Esc>:set tabline=<CR>') + feed(':<CR>') + feed('1234') + screen:expect([[ + {2: + [No Name] }{3: }{4:1234}{3: }| + a | + b | + ^c | + {0:~ }| + {0:~ }| + : | + ]]) end) end) |