• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisiónc9849ed1ce0524811dc13cf26a1349d223925a28 (tree)
Tiempo2021-02-24 03:45:04
AutorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.2547: "%" command not accurate for big files

Commit: https://github.com/vim/vim/commit/2c6553498e790604f50016d8435403523a2576d6
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 23 19:32:03 2021 +0100

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)

Cambiar Resumen

Diferencia incremental

diff -r 97041a388b6e -r c9849ed1ce05 src/normal.c
--- a/src/normal.c Tue Feb 23 19:30:04 2021 +0100
+++ b/src/normal.c Tue Feb 23 19:45:04 2021 +0100
@@ -4769,9 +4769,11 @@
47694769 {
47704770 cap->oap->motion_type = MLINE;
47714771 setpcmark();
4772- // Round up, so CTRL-G will give same value. Watch out for a
4773- // large line count, the line number must not go negative!
4774- if (curbuf->b_ml.ml_line_count > 1000000)
4772+ // Round up, so 'normal 100%' always jumps at the line line.
4773+ // Beyond 21474836 lines, (ml_line_count * 100 + 99) would
4774+ // overflow on 32-bits, so use a formula with less accuracy
4775+ // to avoid overflows.
4776+ if (curbuf->b_ml.ml_line_count >= 21474836)
47754777 curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count + 99L)
47764778 / 100L * cap->count0;
47774779 else
diff -r 97041a388b6e -r c9849ed1ce05 src/version.c
--- a/src/version.c Tue Feb 23 19:30:04 2021 +0100
+++ b/src/version.c Tue Feb 23 19:45:04 2021 +0100
@@ -751,6 +751,8 @@
751751 static int included_patches[] =
752752 { /* Add new patch number below this line */
753753 /**/
754+ 2547,
755+/**/
754756 2546,
755757 /**/
756758 2545,
Show on old repository browser