To: vim_dev@googlegroups.com Subject: Patch 8.2.4705 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4705 Problem: Jump list marker disappears. Solution: Reset reg_executing later. (closes #10111, closes #10100) Files: src/ex_docmd.c, src/getchar.c, src/globals.h, src/structs.h, src/testdir/test_registers.vim *** ../vim-8.2.4704/src/ex_docmd.c 2022-04-04 14:58:02.166539812 +0100 --- src/ex_docmd.c 2022-04-07 13:52:17.939829520 +0100 *************** *** 1733,1738 **** --- 1733,1739 ---- exarg_T ea; // Ex command arguments cmdmod_T save_cmdmod; int save_reg_executing = reg_executing; + int save_pending_end_reg_executing = pending_end_reg_executing; int ni; // set when Not Implemented char_u *cmd; int starts_with_colon = FALSE; *************** *** 2630,2635 **** --- 2631,2637 ---- undo_cmdmod(&cmdmod); cmdmod = save_cmdmod; reg_executing = save_reg_executing; + pending_end_reg_executing = save_pending_end_reg_executing; if (ea.nextcmd && *ea.nextcmd == NUL) // not really a next command ea.nextcmd = NULL; *************** *** 8456,8461 **** --- 8458,8464 ---- sst->save_finish_op = finish_op; sst->save_opcount = opcount; sst->save_reg_executing = reg_executing; + sst->save_pending_end_reg_executing = pending_end_reg_executing; msg_scroll = FALSE; // no msg scrolling in Normal mode restart_edit = 0; // don't go to Insert mode *************** *** 8485,8490 **** --- 8488,8494 ---- finish_op = sst->save_finish_op; opcount = sst->save_opcount; reg_executing = sst->save_reg_executing; + pending_end_reg_executing = sst->save_pending_end_reg_executing; msg_didout |= sst->save_msg_didout; // don't reset msg_didout now current_sctx.sc_version = sst->save_script_version; *** ../vim-8.2.4704/src/getchar.c 2022-04-05 13:16:57.540981208 +0100 --- src/getchar.c 2022-04-07 13:52:22.931817981 +0100 *************** *** 1421,1427 **** static int old_mouse_col; // mouse_col related to old_char static int old_KeyStuffed; // whether old_char was stuffed ! static int can_get_old_char() { // If the old character was not stuffed and characters have been added to // the stuff buffer, need to first get the stuffed characters instead. --- 1421,1427 ---- static int old_mouse_col; // mouse_col related to old_char static int old_KeyStuffed; // whether old_char was stuffed ! static int can_get_old_char(void) { // If the old character was not stuffed and characters have been added to // the stuff buffer, need to first get the stuffed characters instead. *************** *** 2950,2956 **** /* * unget one character (can only be done once!) ! * If the character was stuffed, vgetc() will get it next time it was called. * Otherwise vgetc() will only get it when the stuff buffer is empty. */ void --- 2950,2956 ---- /* * unget one character (can only be done once!) ! * If the character was stuffed, vgetc() will get it next time it is called. * Otherwise vgetc() will only get it when the stuff buffer is empty. */ void *************** *** 2964,2969 **** --- 2964,2990 ---- } /* + * When peeking and not getting a character, reg_executing cannot be cleared + * yet, so set a flag to clear it later. + */ + static void + check_end_reg_executing(int advance) + { + if (reg_executing != 0 && (typebuf.tb_maplen == 0 + || pending_end_reg_executing)) + { + if (advance) + { + reg_executing = 0; + pending_end_reg_executing = FALSE; + } + else + pending_end_reg_executing = TRUE; + } + + } + + /* * Get a byte: * 1. from the stuffbuffer * This is used for abbreviated commands like "D" -> "d$". *************** *** 3026,3033 **** init_typebuf(); start_stuff(); ! if (advance && typebuf.tb_maplen == 0) ! reg_executing = 0; do { /* --- 3047,3053 ---- init_typebuf(); start_stuff(); ! check_end_reg_executing(advance); do { /* *************** *** 3068,3073 **** --- 3088,3094 ---- #ifdef FEAT_CMDL_INFO int showcmd_idx; #endif + check_end_reg_executing(advance); /* * ui_breakcheck() is slow, don't use it too often when * inside a mapping. But call it each time for typed *** ../vim-8.2.4704/src/globals.h 2022-03-28 15:22:31.486443735 +0100 --- src/globals.h 2022-04-07 13:52:22.931817981 +0100 *************** *** 1123,1128 **** --- 1123,1130 ---- EXTERN int reg_recording INIT(= 0); // register for recording or zero EXTERN int reg_executing INIT(= 0); // register being executed or zero + // Flag set when peeking a character and found the end of executed register + EXTERN int pending_end_reg_executing INIT(= 0); // Set when a modifyOtherKeys sequence was seen, then simplified mappings will // no longer be used. *** ../vim-8.2.4704/src/structs.h 2022-04-07 12:39:03.987973874 +0100 --- src/structs.h 2022-04-07 13:52:22.931817981 +0100 *************** *** 4302,4307 **** --- 4302,4308 ---- int save_finish_op; int save_opcount; int save_reg_executing; + int save_pending_end_reg_executing; int save_script_version; tasave_T tabuf; } save_state_T; *** ../vim-8.2.4704/src/testdir/test_registers.vim 2022-01-28 12:50:38.596217550 +0000 --- src/testdir/test_registers.vim 2022-04-07 13:52:22.931817981 +0100 *************** *** 759,764 **** --- 759,782 ---- bwipe! endfunc + func Test_end_reg_executing() + nnoremap s + let @a = 's' + call feedkeys("@aqaq\", 'tx') + call assert_equal('', @a) + call assert_equal('', getline(1)) + + call setline(1, 'aaa') + nnoremap s qa + let @a = 'fa' + call feedkeys("@asq\", 'tx') + call assert_equal('', @a) + call assert_equal('aaa', getline(1)) + + nunmap s + bwipe! + endfunc + " Make sure that y_append is correctly reset " and the previous register is working as expected func Test_register_y_append_reset() *** ../vim-8.2.4704/src/version.c 2022-04-07 13:26:30.153944670 +0100 --- src/version.c 2022-04-07 13:54:36.139518848 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4705, /**/ -- [The rest of the ARMY stand around looking at a loss.] INSPECTOR END OF FILM: (picks up megaphone) All right! Clear off! Go on! "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 ///