To: vim_dev@googlegroups.com Subject: Patch 8.2.3583 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3583 Problem: The "gd" and "gD" commands do not update search stats. (Gary Johnson) Solution: Clear search stats. Files: src/normal.c, src/testdir/test_search_stat.vim, src/testdir/dumps/Test_searchstatgd_1.dump, src/testdir/dumps/Test_searchstatgd_2.dump *** ../vim-8.2.3582/src/normal.c 2021-11-04 13:28:26.082236210 +0000 --- src/normal.c 2021-11-12 10:27:18.638608497 +0000 *************** *** 2305,2316 **** if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0 || find_decl(ptr, len, nchar == 'd', thisblock, SEARCH_START) ! == FAIL) clearopbeep(oap); #ifdef FEAT_FOLDING ! else if ((fdo_flags & FDO_SEARCH) && KeyTyped && oap->op_type == OP_NOP) ! foldOpenCursor(); #endif } /* --- 2305,2324 ---- if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0 || find_decl(ptr, len, nchar == 'd', thisblock, SEARCH_START) ! == FAIL) ! { clearopbeep(oap); + } + else + { #ifdef FEAT_FOLDING ! if ((fdo_flags & FDO_SEARCH) && KeyTyped && oap->op_type == OP_NOP) ! foldOpenCursor(); #endif + // clear any search statistics + if (messaging() && !msg_silent && !shortmess(SHM_SEARCHCOUNT)) + clear_cmdline = TRUE; + } } /* *** ../vim-8.2.3582/src/testdir/test_search_stat.vim 2020-09-23 21:38:01.503927513 +0100 --- src/testdir/test_search_stat.vim 2021-11-12 10:27:12.094408835 +0000 *************** *** 355,358 **** --- 355,383 ---- call delete('Xsearchstat') endfunc + func Test_search_stat_then_gd() + CheckScreendump + + let lines =<< trim END + call setline(1, ['int cat;', 'int dog;', 'cat = dog;']) + set shortmess-=S + set hlsearch + END + call writefile(lines, 'Xsearchstatgd') + + let buf = RunVimInTerminal('-S Xsearchstatgd', #{rows: 10}) + call term_sendkeys(buf, "/dog\") + call TermWait(buf) + call VerifyScreenDump(buf, 'Test_searchstatgd_1', {}) + + call term_sendkeys(buf, "G0gD") + call TermWait(buf) + call VerifyScreenDump(buf, 'Test_searchstatgd_2', {}) + + call StopVimInTerminal(buf) + call delete('Xsearchstatgd') + endfunc + + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.3582/src/testdir/dumps/Test_searchstatgd_1.dump 2021-11-12 10:29:34.350589342 +0000 --- src/testdir/dumps/Test_searchstatgd_1.dump 2021-11-12 10:27:33.295052883 +0000 *************** *** 0 **** --- 1,10 ---- + |i+0&#ffffff0|n|t| |c|a|t|;| @66 + |i|n|t| >d+0&#ffff4012|o|g|;+0&#ffffff0| @66 + |c|a|t| |=| |d+0&#ffff4012|o|g|;+0&#ffffff0| @64 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |/+0#0000000&|d|o|g| @35|[|1|/|2|]| @11|2|,|5| @10|A|l@1| *** ../vim-8.2.3582/src/testdir/dumps/Test_searchstatgd_2.dump 2021-11-12 10:29:34.354589455 +0000 --- src/testdir/dumps/Test_searchstatgd_2.dump 2021-11-12 10:27:34.555090912 +0000 *************** *** 0 **** --- 1,10 ---- + |i+0&#ffffff0|n|t| >c+0&#ffff4012|a|t|;+0&#ffffff0| @66 + |i|n|t| |d|o|g|;| @66 + |c+0&#ffff4012|a|t| +0&#ffffff0|=| |d|o|g|;| @64 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + | +0#0000000&@56|1|,|5| @10|A|l@1| *** ../vim-8.2.3582/src/version.c 2021-11-04 15:46:01.031765172 +0000 --- src/version.c 2021-11-12 09:58:13.647278997 +0000 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3583, /**/ -- FATHER: Who are you? PRINCE: I'm ... your son ... FATHER: Not you. LAUNCELOT: I'm ... er ... Sir Launcelot, sir. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///