summaryrefslogtreecommitdiff
path: root/src/edit.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-02-22 23:03:55 +0100
committerBram Moolenaar <Bram@vim.org>2014-02-22 23:03:55 +0100
commitb1d90a3d770c5e513e6cad8284a5168ac5535883 (patch)
tree5cf472c7e8c9b9c43ddabaeef69927364eafdbc5 /src/edit.c
parent631abc35dfc7ad87255c940fd22eee416c731658 (diff)
downloadvim-git-b1d90a3d770c5e513e6cad8284a5168ac5535883.tar.gz
updated for version 7.4.186v7.4.186
Problem: Insert in Visual mode sometimes gives incorrect results. (Dominique Pelle) Solution: Remember the original insert start position. (Christian Brabandt, Dominique Pelle)
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/edit.c b/src/edit.c
index 29d8d3e65..57bd7761e 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -264,6 +264,7 @@ static char_u *do_insert_char_pre __ARGS((int c));
static colnr_T Insstart_textlen; /* length of line when insert started */
static colnr_T Insstart_blank_vcol; /* vcol for first inserted blank */
+static int update_Insstart_orig = TRUE; /* set Insstart_orig to Insstart */
static char_u *last_insert = NULL; /* the text of the previous insert,
K_SPECIAL and CSI are escaped */
@@ -340,6 +341,9 @@ edit(cmdchar, startln, count)
* error message */
check_for_delay(TRUE);
+ /* set Insstart_orig to Insstart */
+ update_Insstart_orig = TRUE;
+
#ifdef HAVE_SANDBOX
/* Don't allow inserting in the sandbox. */
if (sandbox != 0)
@@ -631,6 +635,9 @@ edit(cmdchar, startln, count)
if (arrow_used) /* don't repeat insert when arrow key used */
count = 0;
+ if (update_Insstart_orig)
+ Insstart_orig = Insstart;
+
if (stop_insert_mode)
{
/* ":stopinsert" used or 'insertmode' reset */
@@ -6923,6 +6930,7 @@ stop_insert(end_insert_pos, esc, nomove)
if (end_insert_pos != NULL)
{
curbuf->b_op_start = Insstart;
+ curbuf->b_op_start_orig = Insstart_orig;
curbuf->b_op_end = *end_insert_pos;
}
}
@@ -8257,6 +8265,7 @@ ins_ctrl_g()
/* Need to reset Insstart, esp. because a BS that joins
* a line to the previous one must save for undo. */
+ update_Insstart_orig = FALSE;
Insstart = curwin->w_cursor;
break;