mirror of
https://github.com/neovim/neovim.git
synced 2026-09-25 06:52:06 +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)
https://github.com/vim/vim/commit/2c6553498e790604f50016d8435403523a2576d6
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)
https://github.com/vim/vim/commit/eba13e4ea28f133ff65f6b426428f49a9bd711b0
This commit is contained in:
+9
-5
@@ -5792,16 +5792,20 @@ static void nv_percent(cmdarg_T *cap)
|
||||
} else {
|
||||
cap->oap->motion_type = kMTLineWise;
|
||||
setpcmark();
|
||||
/* Round up, so CTRL-G will give same value. Watch out for a
|
||||
* large line count, the line number must not go negative! */
|
||||
if (curbuf->b_ml.ml_line_count > 1000000)
|
||||
// Round up, so 'normal 100%' always jumps at the line line.
|
||||
// Beyond 21474836 lines, (ml_line_count * 100 + 99) would
|
||||
// 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)
|
||||
/ 100L * cap->count0;
|
||||
else
|
||||
} else {
|
||||
curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count *
|
||||
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;
|
||||
}
|
||||
beginline(BL_SOL | BL_FIX);
|
||||
}
|
||||
} else { // "%" : go to matching paren
|
||||
|
||||
Reference in New Issue
Block a user