Hi, Bram and list
I reproduce on console vim 7.3.1195 on linux (fedora 17 64bit)
How to reproduce:
1. Prepare rc file
$ cat ~/vimrc_foo
set tabline=%!Foo()
set guioptions-=e
function! Foo()
return gettabwinvar(1, 0, 'foo')
endfunction
2. Start Vim and :tab new
$ vim -N -u ~/vimrc_foo --noplugin -c tabnew
3. Input start visual-mode command (on second tab-page)
V
expected behavior:
Vim become Visual mode.
Actual behavior:
Vim seems to stay in normal mode.
My survey results in Vim's source code:
- f_gettabwinvar() use switch_win() indirectly. (since 7.3.963)
f_gettabwinvar()
getwinvar()
switch_win()
- switch_win() have screen-update effect when tabpage changed.
- Visual mode canceled
switch_win()
goto_tabpage_tp()
leave_tabpage()
reset_VIsual_and_resel()
end_visual_mode()
- full redraw flag is set
switch_win()
goto_tabpage_tp()
enter_tabpage()
must_redraw = CLEAR;
- f_gettabwinvar() get only window's of tappage's variable.
It should not need screen-update effect.
What do you think?
For more information, please refer to vim-jp's Issue. (in Japanese)
https://github.com/vim-jp/issues/issues/415
And I attached a patch. Please check this.
--
Best regards,
Hirohito Higashi
--
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
diff -r c1170f618303 src/eval.c
--- a/src/eval.c Fri Jun 14 22:48:54 2013 +0200
+++ b/src/eval.c Sun Jun 16 03:37:34 2013 +0900
@@ -11950,9 +11950,15 @@
if (win != NULL && varname != NULL)
{
+# ifdef FEAT_AUTOCMD
+ block_autocmds();
+# endif
/* Set curwin to be our win, temporarily. Also set the tabpage,
* otherwise the window is not valid. */
- switch_win(&oldcurwin, &oldtabpage, win, tp);
+ oldcurwin = curwin;
+ curwin = win;
+ curbuf = win->w_buffer;
+
if (*varname == '&') /* window-local-option */
{
@@ -11972,7 +11978,11 @@
}
/* restore previous notion of curwin */
- restore_win(oldcurwin, oldtabpage);
+ curwin = oldcurwin;
+ curbuf = curwin->w_buffer;
+# ifdef FEAT_AUTOCMD
+ unblock_autocmds();
+# endif
}
if (!done && argvars[off + 2].v_type != VAR_UNKNOWN)