Mirror of the Vim source from https://github.com/vim/vim
Revisión | c9849ed1ce0524811dc13cf26a1349d223925a28 (tree) |
---|---|
Tiempo | 2021-02-24 03:45:04 |
Autor | Bram Moolenaar <Bram@vim....> |
Commiter | Bram Moolenaar |
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
@@ -4769,9 +4769,11 @@ | ||
4769 | 4769 | { |
4770 | 4770 | cap->oap->motion_type = MLINE; |
4771 | 4771 | 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) | |
4775 | 4777 | curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count + 99L) |
4776 | 4778 | / 100L * cap->count0; |
4777 | 4779 | else |
@@ -751,6 +751,8 @@ | ||
751 | 751 | static int included_patches[] = |
752 | 752 | { /* Add new patch number below this line */ |
753 | 753 | /**/ |
754 | + 2547, | |
755 | +/**/ | |
754 | 756 | 2546, |
755 | 757 | /**/ |
756 | 758 | 2545, |