To: vim_dev@googlegroups.com Subject: Patch 9.0.0595 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0595 Problem: Extra newline in messages after a verbose shell message. Solution: Output the newline with msg_putchar_attr(). (closes #11233) Make it possible to filter a screendump before comparing it. Files: Filelist, src/misc2.c, src/message.c, src/testdir/test_messages.vim, src/testdir/screendump.vim, src/testdir/dumps/Test_verbose_system_1.vim, src/testdir/dumps/Test_verbose_system_1.dump, src/testdir/dumps/Test_verbose_system_2.vim, src/testdir/dumps/Test_verbose_system_2.dump *** ../vim-9.0.0594/Filelist 2022-09-21 11:56:02.047948576 +0100 --- Filelist 2022-09-26 18:55:00.683424173 +0100 *************** *** 209,214 **** --- 209,215 ---- src/testdir/python_before/*.py \ src/testdir/pyxfile/*.py \ src/testdir/dumps/*.dump \ + src/testdir/dumps/*.vim \ src/testdir/samples/*.txt \ src/testdir/samples/test000 \ src/testdir/color_ramp.vim \ *************** *** 555,561 **** src/if_ole.cpp \ src/if_ole.h \ src/if_ole.idl \ - src/if_perl_msvc/stdbool.h \ src/iscygpty.c \ src/iscygpty.h \ src/iid_ole.c \ --- 556,561 ---- *************** *** 624,633 **** src/xpm/include/*.h \ src/xpm/x64/lib-vc14/libXpm.lib \ src/xpm/x64/lib/libXpm.a \ - src/xpm/x64/lib/libXpm.lib \ src/xpm/x86/lib-vc14/libXpm.lib \ src/xpm/x86/lib/libXpm.a \ - src/xpm/x86/lib/libXpm.lib \ runtime/bitmaps/vim.ico \ nsis/icons.zip \ --- 624,631 ---- *** ../vim-9.0.0594/src/misc2.c 2022-09-12 20:35:22.689554224 +0100 --- src/misc2.c 2022-09-26 17:33:07.308763079 +0100 *************** *** 1795,1801 **** { verbose_enter(); smsg(_("Calling shell to execute: \"%s\""), cmd == NULL ? p_sh : cmd); ! out_char('\n'); cursor_on(); verbose_leave(); } --- 1795,1801 ---- { verbose_enter(); smsg(_("Calling shell to execute: \"%s\""), cmd == NULL ? p_sh : cmd); ! msg_putchar_attr('\n', 0); cursor_on(); verbose_leave(); } *** ../vim-9.0.0594/src/message.c 2022-09-26 15:18:43.778952810 +0100 --- src/message.c 2022-09-26 18:13:50.132232610 +0100 *************** *** 2602,2608 **** if (msg_win != NULL) popup_show_message_win(); #endif ! if (p_more && !recurse) store_sb_text(&sb_str, s, attr, &sb_col, FALSE); msg_check(); --- 2602,2609 ---- if (msg_win != NULL) popup_show_message_win(); #endif ! // Store the text for scroll back, unless it's a newline by itself. ! if (p_more && !recurse && !(s == sb_str + 1 && *sb_str == '\n')) store_sb_text(&sb_str, s, attr, &sb_col, FALSE); msg_check(); *** ../vim-9.0.0594/src/testdir/test_messages.vim 2022-09-26 15:18:43.782952802 +0100 --- src/testdir/test_messages.vim 2022-09-26 19:46:29.195044668 +0100 *************** *** 336,341 **** --- 336,375 ---- call StopVimInTerminal(buf) endfunc + " Test verbose message before echo command + func Test_echo_verbose_system() + CheckRunVimInTerminal + CheckUnix + + let buf = RunVimInTerminal('', {'rows': 10}) + call term_sendkeys(buf, ":4 verbose echo system('seq 20')\") + " Note that the screendump is filtered to remove the name of the temp file + call VerifyScreenDump(buf, 'Test_verbose_system_1', {}) + + " display a page and go back, results in exactly the same view + call term_sendkeys(buf, ' ') + call TermWait(buf) + call term_sendkeys(buf, 'b') + call VerifyScreenDump(buf, 'Test_verbose_system_1', {}) + + " do the same with 'cmdheight' set to 2 + call term_sendkeys(buf, 'q') + call TermWait(buf) + call term_sendkeys(buf, ":set ch=2\") + call TermWait(buf) + call term_sendkeys(buf, ":4 verbose echo system('seq 20')\") + call VerifyScreenDump(buf, 'Test_verbose_system_2', {}) + + call term_sendkeys(buf, ' ') + call TermWait(buf) + call term_sendkeys(buf, 'b') + call VerifyScreenDump(buf, 'Test_verbose_system_2', {}) + + call term_sendkeys(buf, 'q') + call TermWait(buf) + call StopVimInTerminal(buf) + endfunc + func Test_ask_yesno() CheckRunVimInTerminal *** ../vim-9.0.0594/src/testdir/screendump.vim 2022-07-04 17:34:06.390292142 +0100 --- src/testdir/screendump.vim 2022-09-26 19:33:27.179644988 +0100 *************** *** 13,28 **** --- 13,55 ---- finish endif + " Read a dump file "fname" and if "filter" exists apply it to the text. + def ReadAndFilter(fname: string, filter: string): list + var contents = readfile(fname) + + if filereadable(filter) + # do this in the bottom window so that the terminal window is unaffected + wincmd j + enew + setline(1, contents) + exe "source " .. filter + contents = getline(1, '$') + enew! + wincmd k + redraw + endif + + return contents + enddef + + " Verify that Vim running in terminal buffer "buf" matches the screen dump. " "options" is passed to term_dumpwrite(). " Additionally, the "wait" entry can specify the maximum time to wait for the " screen dump to match in msec (default 1000 msec). " The file name used is "dumps/{filename}.dump". + " + " To ignore part of the dump, provide a "dumps/{filename}.vim" file with + " Vim commands to be applied to both the reference and the current dump, so + " that parts that are irrelevant are not used for the comparison. The result + " is NOT written, thus "term_dumpdiff()" shows the difference anyway. + " " Optionally an extra argument can be passed which is prepended to the error " message. Use this when using the same dump file with different options. " Returns non-zero when verification fails. func VerifyScreenDump(buf, filename, options, ...) let reference = 'dumps/' . a:filename . '.dump' + let filter = 'dumps/' . a:filename . '.vim' let testfile = 'failed/' . a:filename . '.dump' let max_loops = get(a:options, 'wait', 1000) / 10 *************** *** 37,42 **** --- 64,76 ---- " text and attributes only from the internal buffer. redraw + if filereadable(reference) + let refdump = ReadAndFilter(reference, filter) + else + " Must be a new screendump, always fail + let refdump = [] + endif + let did_mkdir = 0 if !isdirectory('failed') let did_mkdir = 1 *************** *** 49,61 **** sleep 10m call delete(testfile) call term_dumpwrite(a:buf, testfile, a:options) ! let testdump = readfile(testfile) ! if filereadable(reference) ! let refdump = readfile(reference) ! else ! " Must be a new screendump, always fail ! let refdump = [] ! endif if refdump == testdump call delete(testfile) if did_mkdir --- 83,89 ---- sleep 10m call delete(testfile) call term_dumpwrite(a:buf, testfile, a:options) ! let testdump = ReadAndFilter(testfile, filter) if refdump == testdump call delete(testfile) if did_mkdir *** ../vim-9.0.0594/src/testdir/dumps/Test_verbose_system_1.vim 2022-09-26 19:49:29.479114566 +0100 --- src/testdir/dumps/Test_verbose_system_1.vim 2022-09-26 19:45:21.986979062 +0100 *************** *** 0 **** --- 1,3 ---- + " Filter that removes the ever changing temp directory name from the screendump + " that shows the system() command executed. + 1s+|t|m|p|/|.|.|.*| |+|t|m|p|/|x|x|x|x|x|x|x|/|1| |+ *** ../vim-9.0.0594/src/testdir/dumps/Test_verbose_system_1.dump 2022-09-26 19:49:29.483114566 +0100 --- src/testdir/dumps/Test_verbose_system_1.dump 2022-09-26 18:15:01.632097924 +0100 *************** *** 0 **** --- 1,10 ---- + |C+0&#ffffff0|a|l@1|i|n|g| |s|h|e|l@1| |t|o| |e|x|e|c|u|t|e|:| |"|(|s|e|q| |2|0|)|>|/|t|m|p|/|v|W|4|d|k|0|a|/|0| |2|>|&|1|"| @18 + |1| @73 + |2| @73 + |3| @73 + |4| @73 + |5| @73 + |6| @73 + |7| @73 + |8| @73 + |-+0#00e0003&@1| |M|o|r|e| |-@1> +0#0000000&@64 *** ../vim-9.0.0594/src/testdir/dumps/Test_verbose_system_2.vim 2022-09-26 19:49:29.487114564 +0100 --- src/testdir/dumps/Test_verbose_system_2.vim 2022-09-26 19:45:38.330997301 +0100 *************** *** 0 **** --- 1,3 ---- + " Filter that removes the ever changing temp directory name from the screendump + " that shows the system() command executed. + 1s+|t|m|p|/|.|.|.*| |+|t|m|p|/|x|x|x|x|x|x|x|/|1| |+ *** ../vim-9.0.0594/src/testdir/dumps/Test_verbose_system_2.dump 2022-09-26 19:49:29.495114567 +0100 --- src/testdir/dumps/Test_verbose_system_2.dump 2022-09-26 19:40:49.534402804 +0100 *************** *** 0 **** --- 1,10 ---- + |C+0&#ffffff0|a|l@1|i|n|g| |s|h|e|l@1| |t|o| |e|x|e|c|u|t|e|:| |"|(|s|e|q| |2|0|)|>|/|t|m|p|/|v|V|v|w|c|g|V|/|1| |2|>|&|1|"| @18 + |1| @73 + |2| @73 + |3| @73 + |4| @73 + |5| @73 + |6| @73 + |7| @73 + |8| @73 + |-+0#00e0003&@1| |M|o|r|e| |-@1> +0#0000000&@64 *** ../vim-9.0.0594/src/version.c 2022-09-26 16:02:43.733419780 +0100 --- src/version.c 2022-09-26 19:49:12.911113680 +0100 *************** *** 701,702 **** --- 701,704 ---- { /* Add new patch number below this line */ + /**/ + 595, /**/ -- Wizards had always known that the act of observation changed the thing that was observed, and sometimes forgot that it also changed the observer too. Terry Pratchett - Interesting times /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///