|
|
073263 |
To: vim_dev@googlegroups.com
|
|
|
073263 |
Subject: Patch 7.4.186
|
|
|
073263 |
Fcc: outbox
|
|
|
073263 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
073263 |
Mime-Version: 1.0
|
|
|
073263 |
Content-Type: text/plain; charset=UTF-8
|
|
|
073263 |
Content-Transfer-Encoding: 8bit
|
|
|
073263 |
------------
|
|
|
073263 |
|
|
|
073263 |
Patch 7.4.186 (after 7.4.085)
|
|
|
073263 |
Problem: Insert in Visual mode sometimes gives incorrect results.
|
|
|
073263 |
(Dominique Pelle)
|
|
|
073263 |
Solution: Remember the original insert start position. (Christian Brabandt,
|
|
|
073263 |
Dominique Pelle)
|
|
|
073263 |
Files: src/edit.c, src/globals.h, src/ops.c, src/structs.h
|
|
|
073263 |
|
|
|
073263 |
|
|
|
073263 |
*** ../vim-7.4.185/src/edit.c 2014-01-23 22:45:54.608127182 +0100
|
|
|
073263 |
--- src/edit.c 2014-02-22 22:43:52.820903112 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 264,269 ****
|
|
|
073263 |
--- 264,270 ----
|
|
|
073263 |
|
|
|
073263 |
static colnr_T Insstart_textlen; /* length of line when insert started */
|
|
|
073263 |
static colnr_T Insstart_blank_vcol; /* vcol for first inserted blank */
|
|
|
073263 |
+ static int update_Insstart_orig = TRUE; /* set Insstart_orig to Insstart */
|
|
|
073263 |
|
|
|
073263 |
static char_u *last_insert = NULL; /* the text of the previous insert,
|
|
|
073263 |
K_SPECIAL and CSI are escaped */
|
|
|
073263 |
***************
|
|
|
073263 |
*** 340,345 ****
|
|
|
073263 |
--- 341,349 ----
|
|
|
073263 |
* error message */
|
|
|
073263 |
check_for_delay(TRUE);
|
|
|
073263 |
|
|
|
073263 |
+ /* set Insstart_orig to Insstart */
|
|
|
073263 |
+ update_Insstart_orig = TRUE;
|
|
|
073263 |
+
|
|
|
073263 |
#ifdef HAVE_SANDBOX
|
|
|
073263 |
/* Don't allow inserting in the sandbox. */
|
|
|
073263 |
if (sandbox != 0)
|
|
|
073263 |
***************
|
|
|
073263 |
*** 631,636 ****
|
|
|
073263 |
--- 635,643 ----
|
|
|
073263 |
if (arrow_used) /* don't repeat insert when arrow key used */
|
|
|
073263 |
count = 0;
|
|
|
073263 |
|
|
|
073263 |
+ if (update_Insstart_orig)
|
|
|
073263 |
+ Insstart_orig = Insstart;
|
|
|
073263 |
+
|
|
|
073263 |
if (stop_insert_mode)
|
|
|
073263 |
{
|
|
|
073263 |
/* ":stopinsert" used or 'insertmode' reset */
|
|
|
073263 |
***************
|
|
|
073263 |
*** 6923,6928 ****
|
|
|
073263 |
--- 6930,6936 ----
|
|
|
073263 |
if (end_insert_pos != NULL)
|
|
|
073263 |
{
|
|
|
073263 |
curbuf->b_op_start = Insstart;
|
|
|
073263 |
+ curbuf->b_op_start_orig = Insstart_orig;
|
|
|
073263 |
curbuf->b_op_end = *end_insert_pos;
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
***************
|
|
|
073263 |
*** 8257,8262 ****
|
|
|
073263 |
--- 8265,8271 ----
|
|
|
073263 |
|
|
|
073263 |
/* Need to reset Insstart, esp. because a BS that joins
|
|
|
073263 |
* a line to the previous one must save for undo. */
|
|
|
073263 |
+ update_Insstart_orig = FALSE;
|
|
|
073263 |
Insstart = curwin->w_cursor;
|
|
|
073263 |
break;
|
|
|
073263 |
|
|
|
073263 |
*** ../vim-7.4.185/src/globals.h 2014-02-11 15:10:38.130111835 +0100
|
|
|
073263 |
--- src/globals.h 2014-02-22 23:02:01.644901378 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 752,757 ****
|
|
|
073263 |
--- 752,763 ----
|
|
|
073263 |
*/
|
|
|
073263 |
EXTERN pos_T Insstart; /* This is where the latest
|
|
|
073263 |
* insert/append mode started. */
|
|
|
073263 |
+
|
|
|
073263 |
+ /* This is where the latest insert/append mode started. In contrast to
|
|
|
073263 |
+ * Insstart, this won't be reset by certain keys and is needed for
|
|
|
073263 |
+ * op_insert(), to detect correctly where inserting by the user started. */
|
|
|
073263 |
+ EXTERN pos_T Insstart_orig;
|
|
|
073263 |
+
|
|
|
073263 |
#ifdef FEAT_VREPLACE
|
|
|
073263 |
/*
|
|
|
073263 |
* Stuff for VREPLACE mode.
|
|
|
073263 |
*** ../vim-7.4.185/src/ops.c 2014-02-11 19:33:03.358353098 +0100
|
|
|
073263 |
--- src/ops.c 2014-02-22 22:39:47.588903502 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 2643,2662 ****
|
|
|
073263 |
|
|
|
073263 |
/* The user may have moved the cursor before inserting something, try
|
|
|
073263 |
* to adjust the block for that. */
|
|
|
073263 |
! if (oap->start.lnum == curbuf->b_op_start.lnum && !bd.is_MAX)
|
|
|
073263 |
{
|
|
|
073263 |
if (oap->op_type == OP_INSERT
|
|
|
073263 |
! && oap->start.col != curbuf->b_op_start.col)
|
|
|
073263 |
{
|
|
|
073263 |
! oap->start.col = curbuf->b_op_start.col;
|
|
|
073263 |
pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
|
|
|
073263 |
- oap->start_vcol;
|
|
|
073263 |
oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd);
|
|
|
073263 |
}
|
|
|
073263 |
else if (oap->op_type == OP_APPEND
|
|
|
073263 |
! && oap->end.col >= curbuf->b_op_start.col)
|
|
|
073263 |
{
|
|
|
073263 |
! oap->start.col = curbuf->b_op_start.col;
|
|
|
073263 |
/* reset pre_textlen to the value of OP_INSERT */
|
|
|
073263 |
pre_textlen += bd.textlen;
|
|
|
073263 |
pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
|
|
|
073263 |
--- 2643,2662 ----
|
|
|
073263 |
|
|
|
073263 |
/* The user may have moved the cursor before inserting something, try
|
|
|
073263 |
* to adjust the block for that. */
|
|
|
073263 |
! if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX)
|
|
|
073263 |
{
|
|
|
073263 |
if (oap->op_type == OP_INSERT
|
|
|
073263 |
! && oap->start.col != curbuf->b_op_start_orig.col)
|
|
|
073263 |
{
|
|
|
073263 |
! oap->start.col = curbuf->b_op_start_orig.col;
|
|
|
073263 |
pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
|
|
|
073263 |
- oap->start_vcol;
|
|
|
073263 |
oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd);
|
|
|
073263 |
}
|
|
|
073263 |
else if (oap->op_type == OP_APPEND
|
|
|
073263 |
! && oap->end.col >= curbuf->b_op_start_orig.col)
|
|
|
073263 |
{
|
|
|
073263 |
! oap->start.col = curbuf->b_op_start_orig.col;
|
|
|
073263 |
/* reset pre_textlen to the value of OP_INSERT */
|
|
|
073263 |
pre_textlen += bd.textlen;
|
|
|
073263 |
pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
|
|
|
073263 |
*** ../vim-7.4.185/src/structs.h 2014-02-11 15:10:38.138111836 +0100
|
|
|
073263 |
--- src/structs.h 2014-02-22 22:39:47.588903502 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 1449,1454 ****
|
|
|
073263 |
--- 1449,1455 ----
|
|
|
073263 |
* start and end of an operator, also used for '[ and ']
|
|
|
073263 |
*/
|
|
|
073263 |
pos_T b_op_start;
|
|
|
073263 |
+ pos_T b_op_start_orig; /* used for Insstart_orig */
|
|
|
073263 |
pos_T b_op_end;
|
|
|
073263 |
|
|
|
073263 |
#ifdef FEAT_VIMINFO
|
|
|
073263 |
*** ../vim-7.4.185/src/version.c 2014-02-22 22:27:20.772904692 +0100
|
|
|
073263 |
--- src/version.c 2014-02-22 22:39:08.932903564 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 740,741 ****
|
|
|
073263 |
--- 740,743 ----
|
|
|
073263 |
{ /* Add new patch number below this line */
|
|
|
073263 |
+ /**/
|
|
|
073263 |
+ 186,
|
|
|
073263 |
/**/
|
|
|
073263 |
|
|
|
073263 |
--
|
|
|
073263 |
Individualists unite!
|
|
|
073263 |
|
|
|
073263 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
073263 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
073263 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
073263 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|