diff src/ops.c @ 25487:c26ff3203b43 v8.2.3280

patch 8.2.3280: 'virtualedit' local to buffer is not the best solution Commit: https://github.com/vim/vim/commit/51ad850f5fbafa7aa3f60affa74ec9c9f992c6cc Author: Gary Johnson <garyjohn@spocom.com> Date: Tue Aug 3 18:33:08 2021 +0200 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution Problem: 'virtualedit' local to buffer is not the best solution. Solution: Make it window-local. (Gary Johnson, closes https://github.com/vim/vim/issues/8685)
author Bram Moolenaar <Bram@vim.org>
date Tue, 03 Aug 2021 18:45:04 +0200
parents ac88cd21ae88
children 649d3e9c5914
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -1475,21 +1475,21 @@ op_insert(oparg_T *oap, long count1)
 	// already disabled, but still need it when calling
 	// coladvance_force().
 	// coladvance_force() uses get_ve_flags() to get the 'virtualedit'
-	// state for the current buffer.  To override that state, we need to
-	// set the buffer-local value of ve_flags rather than the global value.
+	// state for the current window.  To override that state, we need to
+	// set the window-local value of ve_flags rather than the global value.
 	if (curwin->w_cursor.coladd > 0)
 	{
-	    int		old_ve_flags = curbuf->b_ve_flags;
+	    int		old_ve_flags = curwin->w_ve_flags;
 
 	    if (u_save_cursor() == FAIL)
 		return;
 
-	    curbuf->b_ve_flags = VE_ALL;
+	    curwin->w_ve_flags = VE_ALL;
 	    coladvance_force(oap->op_type == OP_APPEND
 					   ? oap->end_vcol + 1 : getviscol());
 	    if (oap->op_type == OP_APPEND)
 		--curwin->w_cursor.col;
-	    curbuf->b_ve_flags = old_ve_flags;
+	    curwin->w_ve_flags = old_ve_flags;
 	}
 	// Get the info about the block before entering the text
 	block_prep(oap, &bd, oap->start.lnum, TRUE);