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