From 269a271a108e498a102d88712aa66e3d4e7b82fe Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 28 Aug 2020 09:49:49 -0400 Subject: vim-patch:8.1.1725: MS-Windows: E325 message may use incorrect date format Problem: MS-Windows: E325 message may use incorrect date format. Solution: Convert strftime() result to 'encoding'. Also make the message translatable. (Ken Takata, closes vim/vim#4685, closes vim/vim#4681) https://github.com/vim/vim/commit/663bbc09babea1ff8dfa7ccd58801ac9219fc2b2 --- src/nvim/os/time.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index 346e40e02e..ddc5d3ec84 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -172,10 +172,11 @@ char *os_ctime_r(const time_t *restrict clock, char *restrict result, struct tm *clock_local_ptr = os_localtime_r(clock, &clock_local); // MSVC returns NULL for an invalid value of seconds. if (clock_local_ptr == NULL) { - snprintf(result, result_len, "%s\n", _("(Invalid)")); + xstrlcpy(result, _("(Invalid)"), result_len); } else { - strftime(result, result_len, "%a %b %d %H:%M:%S %Y\n", clock_local_ptr); + strftime(result, result_len, _("%a %b %d %H:%M:%S %Y"), clock_local_ptr); } + xstrlcat(result, "\n", result_len); return result; } -- cgit From 61218d3c776b798a076accc6cf85e48e5dafa76a Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 28 Aug 2020 20:57:20 -0400 Subject: vim-patch:8.2.1033: not easy to read the test time in the test output Problem: Not easy to read the test time in the test output. Solution: Align the times. Make slow tests bold. https://github.com/vim/vim/commit/8d9437968b6693ecb14e7375bcb242e657e75266 --- src/nvim/testdir/runtest.vim | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 4f16aa807c..1e7022db65 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -209,7 +209,15 @@ func RunTheTest(test) let message = 'Executed ' . a:test if has('reltime') - let message ..= ' in ' .. reltimestr(reltime(func_start)) .. ' seconds' + let message ..= repeat(' ', 50 - len(message)) + let time = reltime(func_start) + if has('float') && reltimefloat(time) > 0.1 + let message = &t_md .. message + endif + let message ..= ' in ' .. reltimestr(time) .. ' seconds' + if has('float') && reltimefloat(time) > 0.1 + let message ..= &t_me + endif endif call add(s:messages, message) let s:done += 1 @@ -277,7 +285,9 @@ func FinishTesting() let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test') endif if s:done > 0 && has('reltime') + let message = &t_md .. message .. repeat(' ', 40 - len(message)) let message ..= ' in ' .. reltimestr(reltime(s:start_time)) .. ' seconds' + let message ..= &t_me endif echo message call add(s:messages, message) -- cgit From 40fca0cea8d6db8eb93059d1375630012382e465 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 28 Aug 2020 21:25:34 -0400 Subject: vim-patch:8.2.1315: MS-Windows: test log contains escape sequences Problem: MS-Windows: test log contains escape sequences. Solution: Do not use t_md and t_me but ANSI escape sequences. (Ken Takata, closes vim/vim#6559) https://github.com/vim/vim/commit/45df2a01a79d562b59949383f79625bb8bd89a69 --- src/nvim/testdir/runtest.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 1e7022db65..765ba2cbb6 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -101,6 +101,8 @@ let &runtimepath .= ','.expand($BUILD_DIR).'/runtime/' " Always use forward slashes. set shellslash +let s:t_bold = &t_md +let s:t_normal = &t_me if has('win32') " avoid prompt that is long or contains a line break let $PROMPT = '$P$G' @@ -212,11 +214,11 @@ func RunTheTest(test) let message ..= repeat(' ', 50 - len(message)) let time = reltime(func_start) if has('float') && reltimefloat(time) > 0.1 - let message = &t_md .. message + let message = s:t_bold .. message endif let message ..= ' in ' .. reltimestr(time) .. ' seconds' if has('float') && reltimefloat(time) > 0.1 - let message ..= &t_me + let message ..= s:t_normal endif endif call add(s:messages, message) @@ -285,9 +287,9 @@ func FinishTesting() let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test') endif if s:done > 0 && has('reltime') - let message = &t_md .. message .. repeat(' ', 40 - len(message)) + let message = s:t_bold .. message .. repeat(' ', 40 - len(message)) let message ..= ' in ' .. reltimestr(reltime(s:start_time)) .. ' seconds' - let message ..= &t_me + let message ..= s:t_normal endif echo message call add(s:messages, message) -- cgit From a45dc02a1421a002923a1e85214ab9d08ead9536 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 28 Aug 2020 22:09:16 -0400 Subject: vim-patch:8.1.2198: crash when using :center in autocommand Problem: Crash when using :center in autocommand. Solution: Bail out early for an empty line. (Dominique pelle, closes vim/vim#5095) https://github.com/vim/vim/commit/396b7c78c0fd9cd07528963b18c27398491df40d Cherry-pick 'src/testdir/check.vim' changes from patch 8.1.1544. --- src/nvim/ex_cmds.c | 13 +++++++++---- src/nvim/testdir/check.vim | 24 ++++++++++++++++++++++++ src/nvim/testdir/test_textformat.vim | 20 ++++++++++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 519978f4fb..2bac6cba58 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -326,14 +326,19 @@ static int linelen(int *has_tab) int save; int len; - /* find the first non-blank character */ + // Get the line. If it's empty bail out early (could be the empty string + // for an unloaded buffer). line = get_cursor_line_ptr(); + if (*line == NUL) { + return 0; + } + // find the first non-blank character first = skipwhite(line); - /* find the character after the last non-blank character */ + // find the character after the last non-blank character for (last = first + STRLEN(first); - last > first && ascii_iswhite(last[-1]); --last) - ; + last > first && ascii_iswhite(last[-1]); last--) { + } save = *last; *last = NUL; // Get line length. diff --git a/src/nvim/testdir/check.vim b/src/nvim/testdir/check.vim index 57a8eb57b8..62adc6bca9 100644 --- a/src/nvim/testdir/check.vim +++ b/src/nvim/testdir/check.vim @@ -1,6 +1,30 @@ source shared.vim source term_util.vim +" Command to check for the presence of a feature. +command -nargs=1 CheckFeature call CheckFeature() +func CheckFeature(name) + if !has(a:name) + throw 'Skipped: ' .. a:name .. ' feature missing' + endif +endfunc + +" Command to check for the presence of a working option. +command -nargs=1 CheckOption call CheckOption() +func CheckOption(name) + if !exists('+' .. a:name) + throw 'Skipped: ' .. a:name .. ' option not supported' + endif +endfunc + +" Command to check for the presence of a function. +command -nargs=1 CheckFunction call CheckFunction() +func CheckFunction(name) + if !exists('*' .. a:name) + throw 'Skipped: ' .. a:name .. ' function missing' + endif +endfunc + " Command to check that making screendumps is supported. " Caller must source screendump.vim command CheckScreendump call CheckScreendump() diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim index 75673adf0a..2223be952c 100644 --- a/src/nvim/testdir/test_textformat.vim +++ b/src/nvim/testdir/test_textformat.vim @@ -1,4 +1,7 @@ " Tests for the various 'formatoptions' settings + +source check.vim + func Test_text_format() enew! @@ -490,6 +493,23 @@ func Test_format_list_auto() set fo& ai& bs& endfunc +func Test_crash_github_issue_5095() + CheckFeature autocmd + + " This used to segfault, see https://github.com/vim/vim/issues/5095 + augroup testing + au BufNew x center + augroup END + + next! x + + bw + augroup testing + au! + augroup END + augroup! testing +endfunc + " Test for formatting multi-byte text with 'fo=t' func Test_tw_2_fo_t() new -- cgit From 1fbfd6ba09b9fdf56596ad44c7114f97df4119e8 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 28 Aug 2020 23:42:07 -0400 Subject: vim-patch:8.1.1776: text added with a job isn't displayed Problem: Text added with a job to another buffer isn't displayed. Solution: Update topline after adding a line. (closes vim/vim#4745) https://github.com/vim/vim/commit/4641a122f2ffb820ec6d05526532ab38930c5286 --- src/nvim/testdir/check.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/check.vim b/src/nvim/testdir/check.vim index 62adc6bca9..329dc66ea9 100644 --- a/src/nvim/testdir/check.vim +++ b/src/nvim/testdir/check.vim @@ -25,6 +25,22 @@ func CheckFunction(name) endif endfunc +" Command to check for running on MS-Windows +command CheckMSWindows call CheckMSWindows() +func CheckMSWindows() + if !has('win32') + throw 'Skipped: only works on MS-Windows' + endif +endfunc + +" Command to check for running on Unix +command CheckUnix call CheckUnix() +func CheckUnix() + if !has('unix') + throw 'Skipped: only works on Unix' + endif +endfunc + " Command to check that making screendumps is supported. " Caller must source screendump.vim command CheckScreendump call CheckScreendump() -- cgit From f48847c5781e8021a963ef441ff588e4632686d0 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 28 Aug 2020 23:49:04 -0400 Subject: vim-patch:8.1.1804: no test for display updating without a scroll region Problem: No test for display updating without a scroll region. Solution: Add a test. https://github.com/vim/vim/commit/3c8ee629745737aa231fdd123826ae021e398e49 --- src/nvim/testdir/check.vim | 8 +++ src/nvim/testdir/test_diffmode.vim | 144 ++++++++++++++++++++++++++++++++++--- src/nvim/testdir/test_display.vim | 43 ++++++++--- 3 files changed, 177 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/check.vim b/src/nvim/testdir/check.vim index 329dc66ea9..b530d3a441 100644 --- a/src/nvim/testdir/check.vim +++ b/src/nvim/testdir/check.vim @@ -49,3 +49,11 @@ func CheckScreendump() throw 'Skipped: cannot make screendumps' endif endfunc + +" Command to check that we can Run Vim in a terminal window +command CheckRunVimInTerminal call CheckRunVimInTerminal() +func CheckRunVimInTerminal() + if !CanRunVimInTerminal() + throw 'Skipped: cannot run Vim in a terminal window' + endif +endfunc diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index a1f1dd3bab..51c7b7529e 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -724,10 +724,140 @@ func Test_diff_lastline() bwipe! endfunc +func Test_diff_screen() + CheckScreendump + CheckFeature menu + + " clean up already existing swap files, just in case + call delete('.Xfile1.swp') + call delete('.Xfile2.swp') + + " Test 1: Add a line in beginning of file 2 + call WriteDiffFiles(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) + let buf = RunVimInTerminal('-d Xfile1 Xfile2', {}) + " Set autoread mode, so that Vim won't complain once we re-write the test + " files + call term_sendkeys(buf, ":set autoread\\w:set autoread\\w") + + call VerifyBoth(buf, 'Test_diff_01', '') + + " Test 2: Add a line in beginning of file 1 + call WriteDiffFiles(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) + call VerifyBoth(buf, 'Test_diff_02', '') + + " Test 3: Add a line at the end of file 2 + call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) + call VerifyBoth(buf, 'Test_diff_03', '') + + " Test 4: Add a line at the end of file 1 + call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) + call VerifyBoth(buf, 'Test_diff_04', '') + + " Test 5: Add a line in the middle of file 2, remove on at the end of file 1 + call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10]) + call VerifyBoth(buf, 'Test_diff_05', '') + + " Test 6: Add a line in the middle of file 1, remove on at the end of file 2 + call WriteDiffFiles(buf, [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) + call VerifyBoth(buf, 'Test_diff_06', '') + + " Variants on test 6 with different context settings + call term_sendkeys(buf, ":set diffopt+=context:2\") + call VerifyScreenDump(buf, 'Test_diff_06.2', {}) + call term_sendkeys(buf, ":set diffopt-=context:2\") + call term_sendkeys(buf, ":set diffopt+=context:1\") + call VerifyScreenDump(buf, 'Test_diff_06.1', {}) + call term_sendkeys(buf, ":set diffopt-=context:1\") + call term_sendkeys(buf, ":set diffopt+=context:0\") + call VerifyScreenDump(buf, 'Test_diff_06.0', {}) + call term_sendkeys(buf, ":set diffopt-=context:0\") + + " Test 7 - 9: Test normal/patience/histogram diff algorithm + call WriteDiffFiles(buf, ['#include ', '', '// Frobs foo heartily', 'int frobnitz(int foo)', '{', + \ ' int i;', ' for(i = 0; i < 10; i++)', ' {', ' printf("Your answer is: ");', + \ ' printf("%d\n", foo);', ' }', '}', '', 'int fact(int n)', '{', ' if(n > 1)', ' {', + \ ' return fact(n-1) * n;', ' }', ' return 1;', '}', '', 'int main(int argc, char **argv)', + \ '{', ' frobnitz(fact(10));', '}'], + \ ['#include ', '', 'int fib(int n)', '{', ' if(n > 2)', ' {', + \ ' return fib(n-1) + fib(n-2);', ' }', ' return 1;', '}', '', '// Frobs foo heartily', + \ 'int frobnitz(int foo)', '{', ' int i;', ' for(i = 0; i < 10; i++)', ' {', + \ ' printf("%d\n", foo);', ' }', '}', '', + \ 'int main(int argc, char **argv)', '{', ' frobnitz(fib(10));', '}']) + call term_sendkeys(buf, ":diffupdate!\") + call term_sendkeys(buf, ":set diffopt+=internal\") + call VerifyScreenDump(buf, 'Test_diff_07', {}) + + call term_sendkeys(buf, ":set diffopt+=algorithm:patience\") + call VerifyScreenDump(buf, 'Test_diff_08', {}) + + call term_sendkeys(buf, ":set diffopt+=algorithm:histogram\") + call VerifyScreenDump(buf, 'Test_diff_09', {}) + + " Test 10-11: normal/indent-heuristic + call term_sendkeys(buf, ":set diffopt&vim\") + call WriteDiffFiles(buf, ['', ' def finalize(values)', '', ' values.each do |v|', ' v.finalize', ' end'], + \ ['', ' def finalize(values)', '', ' values.each do |v|', ' v.prepare', ' end', '', + \ ' values.each do |v|', ' v.finalize', ' end']) + call term_sendkeys(buf, ":diffupdate!\") + call term_sendkeys(buf, ":set diffopt+=internal\") + call VerifyScreenDump(buf, 'Test_diff_10', {}) + + " Leave trailing : at commandline! + call term_sendkeys(buf, ":set diffopt+=indent-heuristic\:\") + call VerifyScreenDump(buf, 'Test_diff_11', {}, 'one') + " shouldn't matter, if indent-algorithm comes before or after the algorithm + call term_sendkeys(buf, ":set diffopt&\") + call term_sendkeys(buf, ":set diffopt+=indent-heuristic,algorithm:patience\:\") + call VerifyScreenDump(buf, 'Test_diff_11', {}, 'two') + call term_sendkeys(buf, ":set diffopt&\") + call term_sendkeys(buf, ":set diffopt+=algorithm:patience,indent-heuristic\:\") + call VerifyScreenDump(buf, 'Test_diff_11', {}, 'three') + + " Test 12: diff the same file + call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) + call VerifyBoth(buf, 'Test_diff_12', '') + + " Test 13: diff an empty file + call WriteDiffFiles(buf, [], []) + call VerifyBoth(buf, 'Test_diff_13', '') + + " Test 14: test diffopt+=icase + call WriteDiffFiles(buf, ['a', 'b', 'cd'], ['A', 'b', 'cDe']) + call VerifyBoth(buf, 'Test_diff_14', " diffopt+=filler diffopt+=icase") + + " Test 15-16: test diffopt+=iwhite + call WriteDiffFiles(buf, ['int main()', '{', ' printf("Hello, World!");', ' return 0;', '}'], + \ ['int main()', '{', ' if (0)', ' {', ' printf("Hello, World!");', ' return 0;', ' }', '}']) + call term_sendkeys(buf, ":diffupdate!\") + call term_sendkeys(buf, ":set diffopt&vim diffopt+=filler diffopt+=iwhite\") + call VerifyScreenDump(buf, 'Test_diff_15', {}) + call term_sendkeys(buf, ":set diffopt+=internal\") + call VerifyScreenDump(buf, 'Test_diff_16', {}) + + " Test 17: test diffopt+=iblank + call WriteDiffFiles(buf, ['a', ' ', 'cd', 'ef', 'xxx'], ['a', 'cd', '', 'ef', 'yyy']) + call VerifyInternal(buf, 'Test_diff_17', " diffopt+=iblank") + + " Test 18: test diffopt+=iblank,iwhite / iwhiteall / iwhiteeol + call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhite") + call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhiteall") + call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhiteeol") + + " Test 19: test diffopt+=iwhiteeol + call WriteDiffFiles(buf, ['a ', 'x', 'cd', 'ef', 'xx xx', 'foo', 'bar'], ['a', 'x', 'c d', ' ef', 'xx xx', 'foo', '', 'bar']) + call VerifyInternal(buf, 'Test_diff_19', " diffopt+=iwhiteeol") + + " Test 19: test diffopt+=iwhiteall + call VerifyInternal(buf, 'Test_diff_20', " diffopt+=iwhiteall") + + " clean up + call StopVimInTerminal(buf) + call delete('Xfile1') + call delete('Xfile2') +endfunc + func Test_diff_with_cursorline() - if !CanRunVimInTerminal() - throw 'Skipped: cannot run Vim in a terminal window' - endif + CheckScreendump call writefile([ \ 'hi CursorLine ctermbg=red ctermfg=white', @@ -752,12 +882,8 @@ func Test_diff_with_cursorline() endfunc func Test_diff_of_diff() - if !CanRunVimInTerminal() - throw 'Skipped: cannot run Vim in a terminal window' - endif - if !has("rightleft") - throw 'Skipped: rightleft not supported' - endif + CheckScreendump + CheckFeature rightleft call writefile([ \ 'call setline(1, ["aa","bb","cc","@@ -3,2 +5,7 @@","dd","ee","ff"])', diff --git a/src/nvim/testdir/test_display.vim b/src/nvim/testdir/test_display.vim index 1c2f5a05ff..e41fcdf294 100644 --- a/src/nvim/testdir/test_display.vim +++ b/src/nvim/testdir/test_display.vim @@ -6,11 +6,12 @@ " endif source view_util.vim +source check.vim +source screendump.vim + +func Test_display_foldcolumn() + CheckFeature folding -func! Test_display_foldcolumn() - if !has("folding") - return - endif new vnew vert resize 25 @@ -26,10 +27,10 @@ func! Test_display_foldcolumn() call cursor(2, 1) norm! zt - let lines=ScreenLines([1,2], winwidth(0)) + let lines = ScreenLines([1,2], winwidth(0)) call assert_equal(expect, lines) set fdc=2 - let lines=ScreenLines([1,2], winwidth(0)) + let lines = ScreenLines([1,2], winwidth(0)) let expect = [ \ " e more noise blah blah<", \ " 82> more stuff here " @@ -41,9 +42,8 @@ func! Test_display_foldcolumn() endfunc func! Test_display_foldtext_mbyte() - if !has("folding") - return - endif + CheckFeature folding + call NewWindow(10, 40) call append(0, range(1,20)) exe "set foldmethod=manual foldtext=foldtext() fillchars=fold:\u2500,vert:\u2502 fdc=2" @@ -70,6 +70,31 @@ func! Test_display_foldtext_mbyte() bw! endfunc +" check that win_ins_lines() and win_del_lines() work when t_cs is empty. +func Test_scroll_without_region() + CheckScreendump + + let lines =<< trim END + call setline(1, range(1, 20)) + set t_cs= + set laststatus=2 + END + call writefile(lines, 'Xtestscroll') + let buf = RunVimInTerminal('-S Xtestscroll', #{rows: 10}) + + call VerifyScreenDump(buf, 'Test_scroll_no_region_1', {}) + + call term_sendkeys(buf, ":3delete\") + call VerifyScreenDump(buf, 'Test_scroll_no_region_2', {}) + + call term_sendkeys(buf, ":4put\") + call VerifyScreenDump(buf, 'Test_scroll_no_region_3', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('Xtestscroll') +endfunc + func Test_display_listchars_precedes() set fillchars+=vert:\| call NewWindow(10, 10) -- cgit From d4df5fc90e83334de32fe5fe4a200f3b75a2d8c9 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 29 Aug 2020 00:19:01 -0400 Subject: vim-patch:8.1.1806: test for display updating doesn't check without statusline Problem: Test for display updating doesn't check without statusline. Solution: Add screenshots without a status line. https://github.com/vim/vim/commit/7cc535175a233c6f02cdb5a364b3590560f5bfcb --- src/nvim/testdir/test_display.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test_display.vim b/src/nvim/testdir/test_display.vim index e41fcdf294..db730e0bfd 100644 --- a/src/nvim/testdir/test_display.vim +++ b/src/nvim/testdir/test_display.vim @@ -90,6 +90,17 @@ func Test_scroll_without_region() call term_sendkeys(buf, ":4put\") call VerifyScreenDump(buf, 'Test_scroll_no_region_3', {}) + call term_sendkeys(buf, ":undo\") + call term_sendkeys(buf, ":undo\") + call term_sendkeys(buf, ":set laststatus=0\") + call VerifyScreenDump(buf, 'Test_scroll_no_region_4', {}) + + call term_sendkeys(buf, ":3delete\") + call VerifyScreenDump(buf, 'Test_scroll_no_region_5', {}) + + call term_sendkeys(buf, ":4put\") + call VerifyScreenDump(buf, 'Test_scroll_no_region_6', {}) + " clean up call StopVimInTerminal(buf) call delete('Xtestscroll') -- cgit From 2bae98a5eaf3a53851ccbbbc043e3e401026cdb7 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 29 Aug 2020 00:20:01 -0400 Subject: vim-patch:8.1.2206: no test for fixed issue vim/vim#3893 Problem: No test for fixed issue vim/vim#3893. Solution: Add a test. (Christian Brabandt, vim/vim#3893) https://github.com/vim/vim/commit/28686682e77c0cca963201ae671bd773d86dba31 --- src/nvim/testdir/test_display.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test_display.vim b/src/nvim/testdir/test_display.vim index db730e0bfd..429253a863 100644 --- a/src/nvim/testdir/test_display.vim +++ b/src/nvim/testdir/test_display.vim @@ -161,3 +161,26 @@ func Test_display_listchars_precedes() set list& listchars& wrap& bw! endfunc + +" Check that win_lines() works correctly with the number_only parameter=TRUE +" should break early to optimize cost of drawing, but needs to make sure +" that the number column is correctly highlighted. +func Test_scroll_CursorLineNr_update() + CheckScreendump + + let lines =<< trim END + hi CursorLineNr ctermfg=73 ctermbg=236 + set nu rnu cursorline cursorlineopt=number + exe ":norm! o\110ia\" + END + let filename = 'Xdrawscreen' + call writefile(lines, filename) + let buf = RunVimInTerminal('-S '.filename, #{rows: 5, cols: 50}) + call term_sendkeys(buf, "k") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_winline_rnu', {}) + + " clean up + call StopVimInTerminal(buf) + call delete(filename) +endfunc -- cgit From aa60cb10838996b1764fd8bed2f2c48467b3fab6 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 29 Aug 2020 01:28:09 -0400 Subject: vim-patch:8.1.1831: confusing skipped message Problem: Confusing skipped message. Solution: Drop "run" from "run start the GUI". https://github.com/vim/vim/commit/2514315fc2530170ad7681e45e2b6d1f0680c9eb Cherry-pick 'CheckCanRunGui' user command from patch 8.1.1826. --- src/nvim/testdir/check.vim | 8 ++++++++ src/nvim/testdir/shared.vim | 4 ---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/check.vim b/src/nvim/testdir/check.vim index b530d3a441..073873bcb0 100644 --- a/src/nvim/testdir/check.vim +++ b/src/nvim/testdir/check.vim @@ -57,3 +57,11 @@ func CheckRunVimInTerminal() throw 'Skipped: cannot run Vim in a terminal window' endif endfunc + +" Command to check that we can run the GUI +command CheckCanRunGui call CheckCanRunGui() +func CheckCanRunGui() + if !has('gui') || ($DISPLAY == "" && !has('gui_running')) + throw 'Skipped: cannot start the GUI' + endif +endfunc diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim index 41ff9b2bd6..d56fff1fe8 100644 --- a/src/nvim/testdir/shared.vim +++ b/src/nvim/testdir/shared.vim @@ -329,7 +329,3 @@ func RunVimPiped(before, after, arguments, pipecmd) endif return 1 endfunc - -func CanRunGui() - return has('gui') && ($DISPLAY != "" || has('gui_running')) -endfunc -- cgit From 697a6ca2e4d3546432284f0dc7f60edff0cad4ef Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 29 Aug 2020 09:47:13 -0400 Subject: vim-patch:8.1.2041: no test for diff mode with syntax highlighting Problem: No test for diff mode with syntax highlighting. Solution: Add a test case. https://github.com/vim/vim/commit/248fdb33320641804afed4bdf5dc5cddb1cf64f5 --- src/nvim/testdir/test_diffmode.vim | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 51c7b7529e..f09a64c329 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -881,6 +881,42 @@ func Test_diff_with_cursorline() call delete('Xtest_diff_cursorline') endfunc +func Test_diff_with_syntax() + CheckScreendump + + let lines =<< trim END + void doNothing() { + int x = 0; + char *s = "hello"; + return 5; + } + END + call writefile(lines, 'Xprogram1.c') + let lines =<< trim END + void doSomething() { + int x = 0; + char *s = "there"; + return 5; + } + END + call writefile(lines, 'Xprogram2.c') + + let lines =<< trim END + edit Xprogram1.c + diffsplit Xprogram2.c + END + call writefile(lines, 'Xtest_diff_syntax') + let buf = RunVimInTerminal('-S Xtest_diff_syntax', {}) + + call VerifyScreenDump(buf, 'Test_diff_syntax_1', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('Xtest_diff_syntax') + call delete('Xprogram1.c') + call delete('Xprogram2.c') +endfunc + func Test_diff_of_diff() CheckScreendump CheckFeature rightleft -- cgit From 52a2a1b3d2836b77cfaf2bd6025ce30a90669fc9 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 29 Aug 2020 13:32:19 -0400 Subject: vim-patch:8.1.1694: the RUN_VIM variable is longer than needed Problem: The RUN_VIM variable is longer than needed. Solution: Shorten RUN_VIM. (Daniel Hahler, closes vim/vim#4643) https://github.com/vim/vim/commit/41a82604453080d0011f281532582d3bd360df4a --- src/nvim/testdir/shared.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim index d56fff1fe8..6180d542ff 100644 --- a/src/nvim/testdir/shared.vim +++ b/src/nvim/testdir/shared.vim @@ -271,7 +271,7 @@ func GetVimCommand(...) let cmd = cmd . ' -u ' . name endif let cmd .= ' --headless -i NONE' - let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '') + let cmd = substitute(cmd, 'VIMRUNTIME=\S\+', '', '') " If using valgrind, make sure every run uses a different log file. if cmd =~ 'valgrind.*--log-file=' -- cgit From 62ba227155b59c59f4d2d926bf2d4ed7168a0d97 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 30 Aug 2020 21:19:07 -0400 Subject: vim-patch:8.2.1548: cannot move position of "%%" in message translations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Cannot move position of "%%" in message translations. (Emir Sarı) Solution: Improve the check script. https://github.com/vim/vim/commit/0b8cf278eca45241033033f9bf389e54669a8654 --- src/nvim/po/check.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/nvim/po/check.vim b/src/nvim/po/check.vim index 650c6155e2..d55d4cfa4d 100644 --- a/src/nvim/po/check.vim +++ b/src/nvim/po/check.vim @@ -25,6 +25,7 @@ func! GetMline() " remove '%', not used for formatting. let idline = substitute(idline, "'%'", '', 'g') + let idline = substitute(idline, "%%", '', 'g') " remove '%' used for plural forms. let idline = substitute(idline, '\\nPlural-Forms: .\+;\\n', '', '') -- cgit