To: vim_dev@googlegroups.com Subject: Patch 8.2.2074 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2074 Problem: Vim9: using :normal from Vim9 script can't handle range. Solution: Execute a :normal command in legacy script context. (closes #7401) Files: src/structs.h, src/ex_docmd.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.2073/src/structs.h 2020-11-15 20:32:54.167882094 +0100 --- src/structs.h 2020-12-01 19:40:47.567677152 +0100 *************** *** 4155,4160 **** --- 4155,4161 ---- int save_finish_op; int save_opcount; int save_reg_executing; + int save_script_version; tasave_T tabuf; } save_state_T; *** ../vim-8.2.2073/src/ex_docmd.c 2020-11-30 21:12:15.747157517 +0100 --- src/ex_docmd.c 2020-12-01 20:09:09.256981924 +0100 *************** *** 7994,8003 **** sst->save_finish_op = finish_op; sst->save_opcount = opcount; sst->save_reg_executing = reg_executing; ! msg_scroll = FALSE; // no msg scrolling in Normal mode ! restart_edit = 0; // don't go to Insert mode ! p_im = FALSE; // don't use 'insertmode' /* * Save the current typeahead. This is required to allow using ":normal" --- 7994,8005 ---- sst->save_finish_op = finish_op; sst->save_opcount = opcount; sst->save_reg_executing = reg_executing; + sst->save_script_version = current_sctx.sc_version; ! msg_scroll = FALSE; // no msg scrolling in Normal mode ! restart_edit = 0; // don't go to Insert mode ! p_im = FALSE; // don't use 'insertmode' ! current_sctx.sc_version = 1; // not in Vim9 script /* * Save the current typeahead. This is required to allow using ":normal" *************** *** 8021,8026 **** --- 8023,8029 ---- opcount = sst->save_opcount; reg_executing = sst->save_reg_executing; msg_didout |= sst->save_msg_didout; // don't reset msg_didout now + current_sctx.sc_version = sst->save_script_version; // Restore the state (needed when called from a function executed for // 'indentexpr'). Update the mouse and cursor, they may have changed. *** ../vim-8.2.2073/src/testdir/test_vim9_script.vim 2020-12-01 16:30:40.161598319 +0100 --- src/testdir/test_vim9_script.vim 2020-12-01 20:08:19.749218836 +0100 *************** *** 2958,2963 **** --- 2958,2976 ---- bwipe! enddef + def InvokeNormal() + exe "norm! :m+1\r" + enddef + + def Test_invoke_normal_in_visual_mode() + xnoremap call InvokeNormal() + new + setline(1, ['aaa', 'bbb']) + feedkeys("V\", 'xt') + assert_equal(['bbb', 'aaa'], getline(1, 2)) + xunmap + enddef + " Keep this last, it messes up highlighting. def Test_substitute_cmd() new *** ../vim-8.2.2073/src/version.c 2020-12-01 16:30:40.165598305 +0100 --- src/version.c 2020-12-01 20:07:21.473504964 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2074, /**/ -- The early bird gets the worm. The second mouse gets the cheese. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///