vim-patch:7.4.269

Problem:  CTRL-U in Insert mode does not work after using a cursor key.
          (Pine Wu)
Solution: Use the original insert start position. (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=81c26975e8f9dc7435353581346542409403f296
This commit is contained in:
Marco Hinz 2014-04-29 15:34:02 +02:00 committed by Thiago de Arruda
parent 35ca066039
commit 48fa2be92b
4 changed files with 56 additions and 18 deletions

View File

@ -7339,8 +7339,8 @@ static int ins_bs(int c, int mode, int *inserted_space_p)
((curwin->w_cursor.lnum == 1 && curwin->w_cursor.col == 0) ((curwin->w_cursor.lnum == 1 && curwin->w_cursor.col == 0)
|| (!can_bs(BS_START) || (!can_bs(BS_START)
&& (arrow_used && (arrow_used
|| (curwin->w_cursor.lnum == Insstart.lnum || (curwin->w_cursor.lnum == Insstart_orig.lnum
&& curwin->w_cursor.col <= Insstart.col))) && curwin->w_cursor.col <= Insstart_orig.col)))
|| (!can_bs(BS_INDENT) && !arrow_used && ai_col > 0 || (!can_bs(BS_INDENT) && !arrow_used && ai_col > 0
&& curwin->w_cursor.col <= ai_col) && curwin->w_cursor.col <= ai_col)
|| (!can_bs(BS_EOL) && curwin->w_cursor.col == 0)))) { || (!can_bs(BS_EOL) && curwin->w_cursor.col == 0)))) {
@ -7378,15 +7378,14 @@ static int ins_bs(int c, int mode, int *inserted_space_p)
* delete newline! * delete newline!
*/ */
if (curwin->w_cursor.col == 0) { if (curwin->w_cursor.col == 0) {
lnum = Insstart.lnum; lnum = Insstart_orig.lnum;
if (curwin->w_cursor.lnum == Insstart.lnum if (curwin->w_cursor.lnum == lnum || revins_on) {
|| revins_on
) {
if (u_save((linenr_T)(curwin->w_cursor.lnum - 2), if (u_save((linenr_T)(curwin->w_cursor.lnum - 2),
(linenr_T)(curwin->w_cursor.lnum + 1)) == FAIL) (linenr_T)(curwin->w_cursor.lnum + 1)) == FAIL) {
return FALSE; return FALSE;
--Insstart.lnum; }
Insstart.col = MAXCOL; --Insstart_orig.lnum;
Insstart_orig.col = MAXCOL;
} }
/* /*
* In replace mode: * In replace mode:
@ -7517,9 +7516,10 @@ static int ins_bs(int c, int mode, int *inserted_space_p)
/* insert extra spaces until we are at want_vcol */ /* insert extra spaces until we are at want_vcol */
while (vcol < want_vcol) { while (vcol < want_vcol) {
/* Remember the first char we inserted */ /* Remember the first char we inserted */
if (curwin->w_cursor.lnum == Insstart.lnum if (curwin->w_cursor.lnum == Insstart_orig.lnum
&& curwin->w_cursor.col < Insstart.col) && curwin->w_cursor.col < Insstart_orig.col) {
Insstart.col = curwin->w_cursor.col; Insstart_orig.col = curwin->w_cursor.col;
}
if (State & VREPLACE_FLAG) if (State & VREPLACE_FLAG)
ins_char(' '); ins_char(' ');
@ -7584,8 +7584,8 @@ static int ins_bs(int c, int mode, int *inserted_space_p)
} while ( } while (
revins_on || revins_on ||
(curwin->w_cursor.col > mincol (curwin->w_cursor.col > mincol
&& (curwin->w_cursor.lnum != Insstart.lnum && (curwin->w_cursor.lnum != Insstart_orig.lnum
|| curwin->w_cursor.col != Insstart.col))); || curwin->w_cursor.col != Insstart_orig.col)));
did_backspace = TRUE; did_backspace = TRUE;
} }
did_si = FALSE; did_si = FALSE;
@ -7601,9 +7601,10 @@ static int ins_bs(int c, int mode, int *inserted_space_p)
AppendCharToRedobuff(c); AppendCharToRedobuff(c);
/* If deleted before the insertion point, adjust it */ /* If deleted before the insertion point, adjust it */
if (curwin->w_cursor.lnum == Insstart.lnum if (curwin->w_cursor.lnum == Insstart_orig.lnum
&& curwin->w_cursor.col < Insstart.col) && curwin->w_cursor.col < Insstart_orig.col) {
Insstart.col = curwin->w_cursor.col; Insstart_orig.col = curwin->w_cursor.col;
}
/* vi behaviour: the cursor moves backward but the character that /* vi behaviour: the cursor moves backward but the character that
* was there remains visible * was there remains visible

View File

@ -101,6 +101,34 @@ if (condition) // Remove the next comment leader!
action(); action();
} }
STARTTEST
:" Test with backspace set to the non-compatible setting
/^\d\+ this
:set cp bs=2
Avim1
Avim2u
:set cpo-=<
:inoremap <c-u> <left><c-u>
Avim3
:iunmap <c-u>
Avim4
:" Test with backspace set to the compatible setting
:set bs=
A vim5A
A vim6Azweiu
:inoremap <c-u> <left><c-u>
A vim7
:set cp
ENDTEST
1 this shouldn't be deleted
2 this shouldn't be deleted
3 this shouldn't be deleted
4 this should be deleted
5 this shouldn't be deleted
6 this shouldn't be deleted
7 this shouldn't be deleted
8 this shouldn't be deleted (not touched yet)
STARTTEST STARTTEST
/^{/+1 /^{/+1
:set comments=sO:*\ -,mO:*\ \ ,exO:*/ :set comments=sO:*\ -,mO:*\ \ ,exO:*/

View File

@ -62,6 +62,15 @@ if (condition) // Remove the next comment leader! OK, I will.
action(); action();
} }
1 this shouldn't be deleted
2 this shouldn't be deleted
3 this shouldn't be deleted
4 this should be deleted3
6 this shouldn't be deleted vim5
7 this shouldn't be deleted vim6
8 this shouldn't be deleted (not touched yet) vim7
{ {
/* Make sure the previous comment leader is not removed. */ /* Make sure the previous comment leader is not removed. */

View File

@ -203,7 +203,7 @@ static char *(features[]) = {
static int included_patches[] = { static int included_patches[] = {
// Add new patch number below this line // Add new patch number below this line
//270, //270,
//269, 269,
//268, //268,
//267, //267,
266, 266,