mirror of
https://github.com/neovim/neovim.git
synced 2025-09-26 21:18:34 +00:00
vim-patch:8.2.2547: "%" command not accurate for big files
Problem: "%" command not accurate for big files. Solution: Make it more accurate for files up to 21M lines. (Dominique Pellé, closes vim/vim#7889)2c6553498e
N/A patches for version.c: vim-patch:8.2.2545: errors and crash when terminal window is zero height Problem: Errors and crash when terminal window is zero height. (Leonid V. Fedorenchik) Solution: Do not resize when width or height is zero. (closes vim/vim#7890)eba13e4ea2
This commit is contained in:
@@ -5792,16 +5792,20 @@ static void nv_percent(cmdarg_T *cap)
|
|||||||
} else {
|
} else {
|
||||||
cap->oap->motion_type = kMTLineWise;
|
cap->oap->motion_type = kMTLineWise;
|
||||||
setpcmark();
|
setpcmark();
|
||||||
/* Round up, so CTRL-G will give same value. Watch out for a
|
// Round up, so 'normal 100%' always jumps at the line line.
|
||||||
* large line count, the line number must not go negative! */
|
// Beyond 21474836 lines, (ml_line_count * 100 + 99) would
|
||||||
if (curbuf->b_ml.ml_line_count > 1000000)
|
// overflow on 32-bits, so use a formula with less accuracy
|
||||||
|
// to avoid overflows.
|
||||||
|
if (curbuf->b_ml.ml_line_count >= 21474836) {
|
||||||
curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count + 99L)
|
curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count + 99L)
|
||||||
/ 100L * cap->count0;
|
/ 100L * cap->count0;
|
||||||
else
|
} else {
|
||||||
curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count *
|
curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count *
|
||||||
cap->count0 + 99L) / 100L;
|
cap->count0 + 99L) / 100L;
|
||||||
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
|
}
|
||||||
|
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) {
|
||||||
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
||||||
|
}
|
||||||
beginline(BL_SOL | BL_FIX);
|
beginline(BL_SOL | BL_FIX);
|
||||||
}
|
}
|
||||||
} else { // "%" : go to matching paren
|
} else { // "%" : go to matching paren
|
||||||
|
Reference in New Issue
Block a user