mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
vim-patch:7.4.779
Problem: Using CTRL-A in a line without a number moves the cursor. May
cause a crash when at the start of the line. (Urtica Dioica)
Solution: Do not move the cursor if no number was changed.
3ec3261980
This commit is contained in:
@@ -4231,6 +4231,7 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd)
|
|||||||
int lnum = curwin->w_cursor.lnum;
|
int lnum = curwin->w_cursor.lnum;
|
||||||
int lnume = curwin->w_cursor.lnum;
|
int lnume = curwin->w_cursor.lnum;
|
||||||
int startcol;
|
int startcol;
|
||||||
|
bool did_change = false;
|
||||||
|
|
||||||
dohex = (vim_strchr(curbuf->b_p_nf, 'x') != NULL); // "heX"
|
dohex = (vim_strchr(curbuf->b_p_nf, 'x') != NULL); // "heX"
|
||||||
dooct = (vim_strchr(curbuf->b_p_nf, 'o') != NULL); // "Octal"
|
dooct = (vim_strchr(curbuf->b_p_nf, 'o') != NULL); // "Octal"
|
||||||
@@ -4383,6 +4384,7 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
curwin->w_cursor.col = col;
|
curwin->w_cursor.col = col;
|
||||||
|
did_change = true;
|
||||||
(void)del_char(false);
|
(void)del_char(false);
|
||||||
ins_char(firstdigit);
|
ins_char(firstdigit);
|
||||||
} else {
|
} else {
|
||||||
@@ -4443,6 +4445,7 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd)
|
|||||||
|
|
||||||
// Delete the old number.
|
// Delete the old number.
|
||||||
curwin->w_cursor.col = col;
|
curwin->w_cursor.col = col;
|
||||||
|
did_change = true;
|
||||||
todel = length;
|
todel = length;
|
||||||
c = gchar_cursor();
|
c = gchar_cursor();
|
||||||
|
|
||||||
@@ -4541,7 +4544,9 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd)
|
|||||||
ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, true);
|
ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, true);
|
||||||
RLADDSUBFIX(ptr);
|
RLADDSUBFIX(ptr);
|
||||||
}
|
}
|
||||||
|
if (did_change && curwin->w_cursor.col > 0) {
|
||||||
curwin->w_cursor.col--;
|
curwin->w_cursor.col--;
|
||||||
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -355,7 +355,7 @@ static int included_patches[] = {
|
|||||||
// 782,
|
// 782,
|
||||||
781,
|
781,
|
||||||
// 780 NA
|
// 780 NA
|
||||||
// 779,
|
779,
|
||||||
778,
|
778,
|
||||||
// 777 NA
|
// 777 NA
|
||||||
776,
|
776,
|
||||||
|
Reference in New Issue
Block a user