From 378e6c03f98efc88e8c2675e05a548f9bb7889a1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 14 Jan 2023 11:46:49 +0000 Subject: [PATCH] patch 9.0.1195: restoring KeyTyped when building statusline not tested Problem: Restoring KeyTyped when building statusline not tested. Solution: Add a test. Clean up and fix other tests. (closes #11815) --- src/globals.h | 2 +- .../dumps/Test_statusline_showcmd_1.dump | 10 +++---- .../dumps/Test_statusline_showcmd_2.dump | 6 ++--- .../dumps/Test_statusline_showcmd_3.dump | 10 +++---- .../dumps/Test_statusline_showcmd_4.dump | 6 +++++ .../dumps/Test_statusline_showcmd_5.dump | 6 +++++ src/testdir/dumps/Test_tabline_showcmd_1.dump | 10 +++---- src/testdir/dumps/Test_tabline_showcmd_2.dump | 8 +++--- src/testdir/dumps/Test_tabline_showcmd_3.dump | 6 +++++ src/testdir/dumps/Test_tabline_showcmd_4.dump | 6 +++++ src/testdir/test_statusline.vim | 27 ++++++++++++++++--- src/testdir/test_tabline.vim | 26 ++++++++++++++++-- src/testdir/test_window_cmd.vim | 6 +++++ src/version.c | 2 ++ 14 files changed, 102 insertions(+), 29 deletions(-) create mode 100644 src/testdir/dumps/Test_statusline_showcmd_4.dump create mode 100644 src/testdir/dumps/Test_statusline_showcmd_5.dump create mode 100644 src/testdir/dumps/Test_tabline_showcmd_3.dump create mode 100644 src/testdir/dumps/Test_tabline_showcmd_4.dump diff --git a/src/globals.h b/src/globals.h index 8c3cb62e4..e38b47165 100644 --- a/src/globals.h +++ b/src/globals.h @@ -2043,6 +2043,6 @@ EXTERN int skip_win_fix_scroll INIT(= FALSE); // Skip update_topline() call while executing win_fix_scroll(). EXTERN int skip_update_topline INIT(= FALSE); -// 'showcmd' buffer shared between normal.c and statusline.c +// 'showcmd' buffer shared between normal.c and statusline code #define SHOWCMD_BUFLEN (SHOWCMD_COLS + 1 + 30) EXTERN char_u showcmd_buf[SHOWCMD_BUFLEN]; diff --git a/src/testdir/dumps/Test_statusline_showcmd_1.dump b/src/testdir/dumps/Test_statusline_showcmd_1.dump index 049e0f777..626f60b2d 100644 --- a/src/testdir/dumps/Test_statusline_showcmd_1.dump +++ b/src/testdir/dumps/Test_statusline_showcmd_1.dump @@ -1,6 +1,6 @@ -|a+0&#e0e0e08| +0&#ffffff0@73 -|b+0&#e0e0e08| +0&#ffffff0@73 -|c+0&#e0e0e08> +0&#ffffff0@73 +|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |a|-@59 +>c+0#0000000#ffffff0| @73 |~+0#4040ff13&| @73 -|3+3#0000000&|x|2| @71 -|-+2&&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@56 +|~| @73 +|g+3#0000000&| @73 +| +0&&@74 diff --git a/src/testdir/dumps/Test_statusline_showcmd_2.dump b/src/testdir/dumps/Test_statusline_showcmd_2.dump index c443662dd..2844f129e 100644 --- a/src/testdir/dumps/Test_statusline_showcmd_2.dump +++ b/src/testdir/dumps/Test_statusline_showcmd_2.dump @@ -1,6 +1,6 @@ -|a+0&#ffffff0| @73 +>a+0&#ffffff0| @73 |b| @73 ->c| @73 +|c| @73 |~+0#4040ff13&| @73 -|1+3#0000000&|2|3|4| @70 +| +3#0000000&@74 | +0&&@74 diff --git a/src/testdir/dumps/Test_statusline_showcmd_3.dump b/src/testdir/dumps/Test_statusline_showcmd_3.dump index 26ba3773e..049e0f777 100644 --- a/src/testdir/dumps/Test_statusline_showcmd_3.dump +++ b/src/testdir/dumps/Test_statusline_showcmd_3.dump @@ -1,6 +1,6 @@ -|a+0&#ffffff0| @73 -|b| @73 ->c| @73 +|a+0&#e0e0e08| +0&#ffffff0@73 +|b+0&#e0e0e08| +0&#ffffff0@73 +|c+0&#e0e0e08> +0&#ffffff0@73 |~+0#4040ff13&| @73 -|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @32|1|2|3|4| @6|3|,|1| @11|A|l@1 -|:+0&&| @73 +|3+3#0000000&|x|2| @71 +|-+2&&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@56 diff --git a/src/testdir/dumps/Test_statusline_showcmd_4.dump b/src/testdir/dumps/Test_statusline_showcmd_4.dump new file mode 100644 index 000000000..c443662dd --- /dev/null +++ b/src/testdir/dumps/Test_statusline_showcmd_4.dump @@ -0,0 +1,6 @@ +|a+0&#ffffff0| @73 +|b| @73 +>c| @73 +|~+0#4040ff13&| @73 +|1+3#0000000&|2|3|4| @70 +| +0&&@74 diff --git a/src/testdir/dumps/Test_statusline_showcmd_5.dump b/src/testdir/dumps/Test_statusline_showcmd_5.dump new file mode 100644 index 000000000..26ba3773e --- /dev/null +++ b/src/testdir/dumps/Test_statusline_showcmd_5.dump @@ -0,0 +1,6 @@ +|a+0&#ffffff0| @73 +|b| @73 +>c| @73 +|~+0#4040ff13&| @73 +|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @32|1|2|3|4| @6|3|,|1| @11|A|l@1 +|:+0&&| @73 diff --git a/src/testdir/dumps/Test_tabline_showcmd_1.dump b/src/testdir/dumps/Test_tabline_showcmd_1.dump index de8f62c17..40fea4ec0 100644 --- a/src/testdir/dumps/Test_tabline_showcmd_1.dump +++ b/src/testdir/dumps/Test_tabline_showcmd_1.dump @@ -1,6 +1,6 @@ -| +2&#ffffff0|+| |[|N|o| |N|a|m|e|]| | +1&&@51|3+8#0000001#e0e0e08|x|2| +1#0000000#ffffff0@6 -|a+0&#e0e0e08| +0&#ffffff0@73 -|b+0&#e0e0e08| +0&#ffffff0@73 -|c+0&#e0e0e08> +0&#ffffff0@73 +|g+1&#ffffff0| @73 +|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |a|-@59 +>c+0#0000000#ffffff0| @73 |~+0#4040ff13&| @73 -|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@38|3|,|2| @10|A|l@1| +|~| @73 +| +0#0000000&@56|3|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_tabline_showcmd_2.dump b/src/testdir/dumps/Test_tabline_showcmd_2.dump index b5a7283a8..9765de449 100644 --- a/src/testdir/dumps/Test_tabline_showcmd_2.dump +++ b/src/testdir/dumps/Test_tabline_showcmd_2.dump @@ -1,6 +1,6 @@ -| +2&#ffffff0|+| |[|N|o| |N|a|m|e|]| | +1&&@51|1+8#0000001#e0e0e08|2|3|4| +1#0000000#ffffff0@5 -|a+0&&| @73 +| +1&#ffffff0@74 +>a+0&&| @73 |b| @73 ->c| @73 +|c| @73 |~+0#4040ff13&| @73 -| +0#0000000&@56|3|,|1| @10|A|l@1| +| +0#0000000&@56|1|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_tabline_showcmd_3.dump b/src/testdir/dumps/Test_tabline_showcmd_3.dump new file mode 100644 index 000000000..3e29cda5f --- /dev/null +++ b/src/testdir/dumps/Test_tabline_showcmd_3.dump @@ -0,0 +1,6 @@ +|3+1&#ffffff0|x|2| @71 +|a+0&#e0e0e08| +0&#ffffff0@73 +|b+0&#e0e0e08| +0&#ffffff0@73 +|c+0&#e0e0e08> +0&#ffffff0@73 +|~+0#4040ff13&| @73 +|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@38|3|,|2| @10|A|l@1| diff --git a/src/testdir/dumps/Test_tabline_showcmd_4.dump b/src/testdir/dumps/Test_tabline_showcmd_4.dump new file mode 100644 index 000000000..f9aac49ad --- /dev/null +++ b/src/testdir/dumps/Test_tabline_showcmd_4.dump @@ -0,0 +1,6 @@ +|1+1&#ffffff0|2|3|4| @70 +|a+0&&| @73 +|b| @73 +>c| @73 +|~+0#4040ff13&| @73 +| +0#0000000&@56|3|,|1| @10|A|l@1| diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim index 23613bfed..d06e903ad 100644 --- a/src/testdir/test_statusline.vim +++ b/src/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("\Gl", "xt") + + call term_sendkeys(buf, "g") call VerifyScreenDump(buf, 'Test_statusline_showcmd_1', {}) - call feedkeys("\1234", "xt") + " typing "gg" should open the fold + call term_sendkeys(buf, "g") call VerifyScreenDump(buf, 'Test_statusline_showcmd_2', {}) - call feedkeys("\:set statusline=\:\1234", "xt") + call term_sendkeys(buf, "\Gl") call VerifyScreenDump(buf, 'Test_statusline_showcmd_3', {}) + + call term_sendkeys(buf, "\1234") + call VerifyScreenDump(buf, 'Test_statusline_showcmd_4', {}) + + call term_sendkeys(buf, "\:set statusline=\") + call term_sendkeys(buf, ":\") + 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/testdir/test_tabline.vim b/src/testdir/test_tabline.vim index da738846f..09adf2f68 100644 --- a/src/testdir/test_tabline.vim +++ b/src/testdir/test_tabline.vim @@ -165,19 +165,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("\Gl", "xt") + call term_sendkeys(buf, "g") call VerifyScreenDump(buf, 'Test_tabline_showcmd_1', {}) - call feedkeys("\1234", "xt") + " typing "gg" should open the fold + call term_sendkeys(buf, "g") call VerifyScreenDump(buf, 'Test_tabline_showcmd_2', {}) + + call term_sendkeys(buf, "\Gl") + call VerifyScreenDump(buf, 'Test_tabline_showcmd_3', {}) + + call term_sendkeys(buf, "\1234") + call VerifyScreenDump(buf, 'Test_tabline_showcmd_4', {}) + + call term_sendkeys(buf, "\:set tabline=\") + call term_sendkeys(buf, ":\") + 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/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index 3e841891f..a97ccba2d 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -1861,6 +1861,8 @@ function Test_splitkeep_callback() call term_sendkeys(buf, ":quit\Gt") call VerifyScreenDump(buf, 'Test_splitkeep_callback_4', {}) + + call StopVimInTerminal(buf) endfunc function Test_splitkeep_fold() @@ -1891,6 +1893,8 @@ function Test_splitkeep_fold() call term_sendkeys(buf, ":wincmd k\:quit\") call VerifyScreenDump(buf, 'Test_splitkeep_fold_4', {}) + + call StopVimInTerminal(buf) endfunction function Test_splitkeep_status() @@ -1909,6 +1913,8 @@ function Test_splitkeep_status() call term_sendkeys(buf, ":call win_move_statusline(win, 1)\") call VerifyScreenDump(buf, 'Test_splitkeep_status_1', {}) + + call StopVimInTerminal(buf) endfunction function Test_new_help_window_on_error() diff --git a/src/version.c b/src/version.c index 65c9e350c..7a028945b 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1195, /**/ 1194, /**/ -- 2.40.0