mirror of
https://github.com/neovim/neovim.git
synced 2025-09-26 04:58:33 +00:00
vim-patch:8.0.0962
closes #6726
Problem: Crash with virtualedit and joining lines.
(Joshua T Corbin, Neovim #6726)
Solution: When using a mark check that coladd is valid.
9aa1569128
This commit is contained in:
@@ -375,17 +375,27 @@ void check_cursor_col_win(win_T *win)
|
||||
win->w_cursor.col = 0;
|
||||
}
|
||||
|
||||
/* If virtual editing is on, we can leave the cursor on the old position,
|
||||
* only we must set it to virtual. But don't do it when at the end of the
|
||||
* line. */
|
||||
if (oldcol == MAXCOL)
|
||||
// If virtual editing is on, we can leave the cursor on the old position,
|
||||
// only we must set it to virtual. But don't do it when at the end of the
|
||||
// line.
|
||||
if (oldcol == MAXCOL) {
|
||||
win->w_cursor.coladd = 0;
|
||||
else if (ve_flags == VE_ALL) {
|
||||
if (oldcoladd > win->w_cursor.col)
|
||||
} else if (ve_flags == VE_ALL) {
|
||||
if (oldcoladd > win->w_cursor.col) {
|
||||
win->w_cursor.coladd = oldcoladd - win->w_cursor.col;
|
||||
else
|
||||
/* avoid weird number when there is a miscalculation or overflow */
|
||||
if (win->w_cursor.col < len && win->w_cursor.coladd > 0) {
|
||||
int cs, ce;
|
||||
|
||||
// check that coladd is not more than the char width
|
||||
getvcol(win, &win->w_cursor, &cs, NULL, &ce);
|
||||
if (win->w_cursor.coladd > ce - cs) {
|
||||
win->w_cursor.coladd = ce - cs;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// avoid weird number when there is a miscalculation or overflow
|
||||
win->w_cursor.coladd = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user