Patch 8.2.2074

7 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 1, 2020, 2:13:06 PM12/1/20
to vim...@googlegroups.com

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 <F3> <Cmd>call <SID>InvokeNormal()<CR>
+ new
+ setline(1, ['aaa', 'bbb'])
+ feedkeys("V\<F3>", 'xt')
+ assert_equal(['bbb', 'aaa'], getline(1, 2))
+ xunmap <F3>
+ 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 -- Br...@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 ///

Tony Mechelynck

unread,
Dec 1, 2020, 3:36:26 PM12/1/20
to Bram Moolenaar, vim_dev
Fatal eror compiling ex_docmd.c with Tiny or Small features:

linux-2iyu:~/.build/vim/vim-hg/src/shadow-tiny # (make || echo 'exit
status' $? ; date) 2>&1 |tee -a make.log
[...]
gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -fno-strength-reduce -Wall
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/ex_docmd.o
ex_docmd.c
ex_docmd.c: In function ‘save_current_state’:
ex_docmd.c:7997:32: error: ‘current_sctx’ undeclared (first use in
this function); did you mean ‘current_sent’?
sst->save_script_version = current_sctx.sc_version;
^~~~~~~~~~~~
current_sent
ex_docmd.c:7997:32: note: each undeclared identifier is reported only
once for each function it appears in
ex_docmd.c: In function ‘restore_current_state’:
ex_docmd.c:8026:5: error: ‘current_sctx’ undeclared (first use in this
function); did you mean ‘current_sent’?
current_sctx.sc_version = sst->save_script_version;
^~~~~~~~~~~~
current_sent
make: *** [Makefile:3231: objects/ex_docmd.o] Error 1
exit status 2
Tue 1 Dec 21:30:00 CET 2020
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202012011912.0B1JCueq3887430%40masaka.moolenaar.net.
Reply all
Reply to author
Forward
0 new messages