To: vim_dev@googlegroups.com Subject: Patch 9.0.1298 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1298 Problem: Inserting a register on the command line does not trigger incsearch or update hlsearch. Solution: Have cmdline_insert_reg() return CMDLINE_CHANGED when appropriate and handle it correctly. (Ken Takata, closes #11960) Files: src/ex_getln.c, src/testdir/test_hlsearch.vim, src/testdir/dumps/Test_hlsearch_ctrlr_1.dump *** ../vim-9.0.1297/src/ex_getln.c 2023-02-06 20:58:03.432471939 +0000 --- src/ex_getln.c 2023-02-10 21:36:43.533508782 +0000 *************** *** 1183,1188 **** --- 1183,1189 ---- { int i; int c; + int literally = FALSE; #ifdef FEAT_EVAL int save_new_cmdpos = new_cmdpos; #endif *************** *** 1220,1226 **** #endif if (c != ESC) // use ESC to cancel inserting register { ! cmdline_paste(c, i == Ctrl_R, FALSE); #ifdef FEAT_EVAL // When there was a serious error abort getting the --- 1221,1228 ---- #endif if (c != ESC) // use ESC to cancel inserting register { ! literally = i == Ctrl_R; ! cmdline_paste(c, literally, FALSE); #ifdef FEAT_EVAL // When there was a serious error abort getting the *************** *** 1251,1258 **** // remove the double quote redrawcmd(); ! // The text has been stuffed, the command line didn't change yet. ! return CMDLINE_NOT_CHANGED; } /* --- 1253,1261 ---- // remove the double quote redrawcmd(); ! // The text has been stuffed, the command line didn't change yet, but it ! // will change soon. The caller must take care of it. ! return literally ? CMDLINE_NOT_CHANGED : CMDLINE_CHANGED; } /* *************** *** 2081,2091 **** case Ctrl_R: // insert register res = cmdline_insert_reg(&gotesc); ! if (res == CMDLINE_NOT_CHANGED) ! goto cmdline_not_changed; ! else if (res == GOTO_NORMAL_MODE) goto returncmd; ! goto cmdline_changed; case Ctrl_D: if (showmatches(&xpc, FALSE) == EXPAND_NOTHING) --- 2084,2096 ---- case Ctrl_R: // insert register res = cmdline_insert_reg(&gotesc); ! if (res == GOTO_NORMAL_MODE) goto returncmd; ! #ifdef FEAT_SEARCH_EXTRA ! if (res == CMDLINE_NOT_CHANGED) ! is_state.incsearch_postponed = TRUE; ! #endif ! goto cmdline_not_changed; case Ctrl_D: if (showmatches(&xpc, FALSE) == EXPAND_NOTHING) *** ../vim-9.0.1297/src/testdir/test_hlsearch.vim 2022-06-19 16:16:11.000000000 +0100 --- src/testdir/test_hlsearch.vim 2023-02-10 21:33:11.041654558 +0000 *************** *** 1,6 **** --- 1,7 ---- " Test for v:hlsearch source check.vim + source screendump.vim func Test_hlsearch() new *************** *** 72,75 **** --- 73,94 ---- bwipe! endfunc + func Test_hlsearch_Ctrl_R() + CheckRunVimInTerminal + + let lines =<< trim END + set incsearch hlsearch + let @" = "text" + put + END + call writefile(lines, 'XhlsearchCtrlR', 'D') + let buf = RunVimInTerminal('-S XhlsearchCtrlR', #{rows: 6, cols: 60}) + + call term_sendkeys(buf, "/\\\"") + call VerifyScreenDump(buf, 'Test_hlsearch_ctrlr_1', {}) + + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.1297/src/testdir/dumps/Test_hlsearch_ctrlr_1.dump 2023-02-10 21:38:03.569458350 +0000 --- src/testdir/dumps/Test_hlsearch_ctrlr_1.dump 2023-02-10 21:33:13.997652394 +0000 *************** *** 0 **** --- 1,6 ---- + | +0&#ffffff0@59 + |t+1&&|e|x|t| +0&&@55 + |~+0#4040ff13&| @58 + |~| @58 + |~| @58 + |/+0#0000000&|t|e|x|t> @54 *** ../vim-9.0.1297/src/version.c 2023-02-10 20:49:04.399434946 +0000 --- src/version.c 2023-02-10 21:18:34.182300070 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1298, /**/ -- Corduroy pillows: They're making headlines! /// 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 ///