aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-01-29 07:42:22 +0800
committerGitHub <noreply@github.com>2023-01-29 07:42:22 +0800
commit4c90a84c61d19e5131579b2c38960de3ec8e4a5e (patch)
treebb0ead0ccdd974b1e9bccdad6ee82a1452907ff2
parentb4c4c232ba6fe3df5c6f12faff4405a16e4d40df (diff)
downloadrneovim-4c90a84c61d19e5131579b2c38960de3ec8e4a5e.tar.gz
rneovim-4c90a84c61d19e5131579b2c38960de3ec8e4a5e.tar.bz2
rneovim-4c90a84c61d19e5131579b2c38960de3ec8e4a5e.zip
vim-patch:9.0.1255: changing 'virtualedit' does not have immediate effect (#22039)
Problem: Changing 'virtualedit' does not have immediate effect. Solution: Correct how is checked for a changed value. (closes vim/vim#11878) https://github.com/vim/vim/commit/8fe5b9c8c1223861cec0484ccc031858ae08d107 Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r--src/nvim/optionstr.c3
-rw-r--r--src/nvim/testdir/test_virtualedit.vim13
2 files changed, 15 insertions, 1 deletions
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 5ebff9ed77..30afb0db37 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -1404,10 +1404,11 @@ static void did_set_virtualedit(win_T *win, int opt_flags, char *oldval, char **
} else {
if (opt_strings_flags(ve, p_ve_values, flags, true) != OK) {
*errmsg = e_invarg;
- } else if (strcmp(p_ve, oldval) != 0) {
+ } else if (strcmp(ve, oldval) != 0) {
// Recompute cursor position in case the new 've' setting
// changes something.
validate_virtcol_win(win);
+ // XXX: this only works when win == curwin
coladvance(win->w_virtcol);
}
}
diff --git a/src/nvim/testdir/test_virtualedit.vim b/src/nvim/testdir/test_virtualedit.vim
index 2bf8c3fc77..20a5f87517 100644
--- a/src/nvim/testdir/test_virtualedit.vim
+++ b/src/nvim/testdir/test_virtualedit.vim
@@ -537,6 +537,19 @@ func Test_global_local_virtualedit()
set virtualedit&
endfunc
+func Test_virtualedit_setlocal()
+ enew
+ setglobal virtualedit=all
+ setlocal virtualedit=all
+ normal! l
+ redraw
+ setlocal virtualedit=none
+ call assert_equal(1, wincol())
+
+ setlocal virtualedit&
+ set virtualedit&
+endfunc
+
func Test_virtualedit_mouse()
let save_mouse = &mouse
set mouse=a