To: vim_dev@googlegroups.com Subject: Patch 8.2.2547 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2547 Problem: "%" command not accurate for big files. Solution: Make it more accurate for files up to 21M lines. (Dominique Pellé, closes #7889) Files: src/normal.c *** ../vim-8.2.2546/src/normal.c 2021-01-28 17:24:54.277803692 +0100 --- src/normal.c 2021-02-23 19:25:07.993462076 +0100 *************** *** 4769,4777 **** { cap->oap->motion_type = MLINE; 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) curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count + 99L) / 100L * cap->count0; else --- 4769,4779 ---- { cap->oap->motion_type = MLINE; setpcmark(); ! // 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 *** ../vim-8.2.2546/src/version.c 2021-02-23 19:19:53.826835832 +0100 --- src/version.c 2021-02-23 19:26:33.477092967 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2547, /**/ -- BEDEVERE: Oooooh! LAUNCELOT: No "Aaaaarrrrrrggghhh ... " at the back of the throat. BEDEVERE: No! "Oooooh!" in surprise and alarm! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///