aboutsummaryrefslogtreecommitdiff
path: root/src/edit.c
diff options
context:
space:
mode:
authoroni-link <knil.ino@gmail.com>2014-04-08 20:08:30 +0200
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-08 21:58:13 -0300
commitd11f805150e644aa1c005729505c05971bdecc39 (patch)
tree423ace6638982f2b2b53ccb6240570ba336fe961 /src/edit.c
parentac620411383259400cff2f12ffe576f066ed4ca7 (diff)
downloadrneovim-d11f805150e644aa1c005729505c05971bdecc39.tar.gz
rneovim-d11f805150e644aa1c005729505c05971bdecc39.tar.bz2
rneovim-d11f805150e644aa1c005729505c05971bdecc39.zip
vim-patch:7.4.186
Problem: Insert in Visual mode sometimes gives incorrect results. (Dominique Pelle) Solution: Remember the original insert start position. (Christian Brabandt, Dominique Pelle) https://code.google.com/p/vim/source/detail?r=4d12112c5efae071aecbeed1a7196f18950457b3
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/edit.c b/src/edit.c
index 4a17c9aa44..fb60fb25c1 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -284,6 +284,7 @@ static char_u *do_insert_char_pre(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 bool 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 */
@@ -353,6 +354,9 @@ edit (
* 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) {
@@ -582,6 +586,10 @@ edit (
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 */
count = 0;
@@ -5860,6 +5868,7 @@ stop_insert (
* now in a different buffer. */
if (end_insert_pos != NULL) {
curbuf->b_op_start = Insstart;
+ curbuf->b_op_start_orig = Insstart_orig;
curbuf->b_op_end = *end_insert_pos;
}
}
@@ -6944,6 +6953,7 @@ static void ins_ctrl_g(void)
/* 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;