mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
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 #7889)
This commit is contained in:
@@ -4769,9 +4769,11 @@ nv_percent(cmdarg_T *cap)
|
|||||||
{
|
{
|
||||||
cap->oap->motion_type = MLINE;
|
cap->oap->motion_type = MLINE;
|
||||||
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
|
||||||
|
@@ -750,6 +750,8 @@ 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 */
|
||||||
|
/**/
|
||||||
|
2547,
|
||||||
/**/
|
/**/
|
||||||
2546,
|
2546,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user