To: vim_dev@googlegroups.com Subject: Patch 9.0.0457 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0457 Problem: Substitute prompt does not highlight an empty match. Solution: Highlight at least one character. Files: src/ex_cmds.c, src/testdir/test_substitute.vim, src/testdir/dumps/Test_sub_highlight_zer_match_1.dump *** ../vim-9.0.0456/src/ex_cmds.c 2022-08-31 14:46:07.907016957 +0100 --- src/ex_cmds.c 2022-09-13 13:44:08.506615474 +0100 *************** *** 4308,4313 **** --- 4308,4317 ---- - regmatch.startpos[0].lnum; search_match_endcol = regmatch.endpos[0].col + len_change; + if (search_match_lines == 0 + && search_match_endcol == 0) + // highlight at least one character for /^/ + search_match_endcol = 1; highlight_match = TRUE; update_topline(); *** ../vim-9.0.0456/src/testdir/test_substitute.vim 2022-09-02 21:55:45.507049444 +0100 --- src/testdir/test_substitute.vim 2022-09-13 13:42:43.750828410 +0100 *************** *** 2,7 **** --- 2,8 ---- source shared.vim source check.vim + source screendump.vim func Test_multiline_subst() enew! *************** *** 684,689 **** --- 685,705 ---- bw! endfunc + func Test_sub_highlight_zero_match() + CheckRunVimInTerminal + + let lines =<< trim END + call setline(1, ['one', 'two', 'three']) + END + call writefile(lines, 'XscriptSubHighlight', 'D') + let buf = RunVimInTerminal('-S XscriptSubHighlight', #{rows: 8, cols: 60}) + call term_sendkeys(buf, ":%s/^/ /c\") + call VerifyScreenDump(buf, 'Test_sub_highlight_zer_match_1', {}) + + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) + endfunc + func Test_nocatch_sub_failure_handling() " normal error results in all replacements func Foo() *** ../vim-9.0.0456/src/testdir/dumps/Test_sub_highlight_zer_match_1.dump 2022-09-13 13:44:35.778546986 +0100 --- src/testdir/dumps/Test_sub_highlight_zer_match_1.dump 2022-09-13 13:42:46.838820655 +0100 *************** *** 0 **** --- 1,8 ---- + |o+1&#ffffff0|n+0&&|e| @56 + |t|w|o| @56 + |t|h|r|e@1| @54 + |~+0#4040ff13&| @58 + |~| @58 + |~| @58 + |~| @58 + |r+0#00e0003&|e|p|l|a|c|e| |w|i|t|h| @1|.@2|/|a|/|q|/|l|/|^|E|/|^|Y|)|?> +0#0000000&@10|1|,|1| @10|A|l@1| *** ../vim-9.0.0456/src/version.c 2022-09-13 12:36:53.860094694 +0100 --- src/version.c 2022-09-13 13:44:26.746569668 +0100 *************** *** 705,706 **** --- 705,708 ---- { /* Add new patch number below this line */ + /**/ + 457, /**/ -- hundred-and-one symptoms of being an internet addict: 56. You leave the modem speaker on after connecting because you think it sounds like the ocean wind...the perfect soundtrack for "surfing the net". /// 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 ///