diff options
Diffstat (limited to 'data/vim/patches/8.1.0959')
-rw-r--r-- | data/vim/patches/8.1.0959 | 199 |
1 files changed, 0 insertions, 199 deletions
diff --git a/data/vim/patches/8.1.0959 b/data/vim/patches/8.1.0959 deleted file mode 100644 index c7299e0f7..000000000 --- a/data/vim/patches/8.1.0959 +++ /dev/null @@ -1,199 +0,0 @@ -To: vim_dev@googlegroups.com -Subject: Patch 8.1.0959 -Fcc: outbox -From: Bram Moolenaar <Bram@moolenaar.net> -Mime-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit ------------- - -Patch 8.1.0959 -Problem: Sorting large numbers is not tested and does not work properly. -Solution: Add test. Fix comparing lines with and without a number. - (Dominique Pelle, closes #4017) -Files: src/ex_cmds.c, src/testdir/test_sort.vim - -*** ../vim-8.1.0958/src/ex_cmds.c 2019-02-17 17:44:36.203875545 +0100 ---- src/ex_cmds.c 2019-02-20 22:15:27.631399246 +0100 -*************** -*** 303,309 **** - varnumber_T start_col_nr; /* starting column number */ - varnumber_T end_col_nr; /* ending column number */ - } line; -! varnumber_T value; /* value if sorting by integer */ - #ifdef FEAT_FLOAT - float_T value_flt; /* value if sorting by float */ - #endif ---- 303,313 ---- - varnumber_T start_col_nr; /* starting column number */ - varnumber_T end_col_nr; /* ending column number */ - } line; -! struct -! { -! varnumber_T value; /* value if sorting by integer */ -! int is_number; /* TRUE when line contains a number */ -! } num; - #ifdef FEAT_FLOAT - float_T value_flt; /* value if sorting by float */ - #endif -*************** -*** 335,345 **** - if (got_int) - sort_abort = TRUE; - -- /* When sorting numbers "start_col_nr" is the number, not the column -- * number. */ - if (sort_nr) -! result = l1.st_u.value == l2.st_u.value ? 0 -! : l1.st_u.value > l2.st_u.value ? 1 : -1; - #ifdef FEAT_FLOAT - else if (sort_flt) - result = l1.st_u.value_flt == l2.st_u.value_flt ? 0 ---- 339,352 ---- - if (got_int) - sort_abort = TRUE; - - if (sort_nr) -! { -! if (l1.st_u.num.is_number != l2.st_u.num.is_number) -! result = l1.st_u.num.is_number - l2.st_u.num.is_number; -! else -! result = l1.st_u.num.value == l2.st_u.num.value ? 0 -! : l1.st_u.num.value > l2.st_u.num.value ? 1 : -1; -! } - #ifdef FEAT_FLOAT - else if (sort_flt) - result = l1.st_u.value_flt == l2.st_u.value_flt ? 0 -*************** -*** 553,563 **** - if (s > p && s[-1] == '-') - --s; /* include preceding negative sign */ - if (*s == NUL) -! /* empty line should sort before any number */ -! nrs[lnum - eap->line1].st_u.value = -MAXLNUM; - else - vim_str2nr(s, NULL, NULL, sort_what, -! &nrs[lnum - eap->line1].st_u.value, NULL, 0); - } - #ifdef FEAT_FLOAT - else ---- 560,576 ---- - if (s > p && s[-1] == '-') - --s; /* include preceding negative sign */ - if (*s == NUL) -! { -! /* line without number should sort before any number */ -! nrs[lnum - eap->line1].st_u.num.is_number = FALSE; -! nrs[lnum - eap->line1].st_u.num.value = 0; -! } - else -+ { -+ nrs[lnum - eap->line1].st_u.num.is_number = TRUE; - vim_str2nr(s, NULL, NULL, sort_what, -! &nrs[lnum - eap->line1].st_u.num.value, NULL, 0); -! } - } - #ifdef FEAT_FLOAT - else -*** ../vim-8.1.0958/src/testdir/test_sort.vim 2018-09-21 12:46:16.341772938 +0200 ---- src/testdir/test_sort.vim 2019-02-20 22:15:27.631399246 +0100 -*************** -*** 1222,1227 **** ---- 1222,1298 ---- - enew! - endfunc - -+ func Test_sort_large_num() -+ new -+ a -+ -2147483648 -+ -2147483647 -+ -+ -1 -+ 0 -+ 1 -+ -2147483646 -+ 2147483646 -+ 2147483647 -+ 2147483647 -+ -2147483648 -+ abc -+ -+ . -+ " Numerical sort. Non-numeric lines are ordered before numerical lines. -+ " Ordering of non-numerical is stable. -+ sort n -+ call assert_equal(['', -+ \ 'abc', -+ \ '', -+ \ '-2147483648', -+ \ '-2147483648', -+ \ '-2147483647', -+ \ '-2147483646', -+ \ '-1', -+ \ '0', -+ \ '1', -+ \ '2147483646', -+ \ '2147483647', -+ \ '2147483647'], getline(1, '$')) -+ bwipe! -+ -+ if has('num64') -+ new -+ a -+ -9223372036854775808 -+ -9223372036854775807 -+ -+ -1 -+ 0 -+ 1 -+ -9223372036854775806 -+ 9223372036854775806 -+ 9223372036854775807 -+ 9223372036854775807 -+ -9223372036854775808 -+ abc -+ -+ . -+ sort n -+ call assert_equal(['', -+ \ 'abc', -+ \ '', -+ \ '-9223372036854775808', -+ \ '-9223372036854775808', -+ \ '-9223372036854775807', -+ \ '-9223372036854775806', -+ \ '-1', -+ \ '0', -+ \ '1', -+ \ '9223372036854775806', -+ \ '9223372036854775807', -+ \ '9223372036854775807'], getline(1, '$')) -+ bwipe! -+ endif -+ endfunc -+ -+ - func Test_sort_cmd_report() - enew! - call append(0, repeat([1], 3) + repeat([2], 3) + repeat([3], 3)) -*** ../vim-8.1.0958/src/version.c 2019-02-20 22:04:28.823721308 +0100 ---- src/version.c 2019-02-20 22:17:16.762701596 +0100 -*************** -*** 781,782 **** ---- 781,784 ---- - { /* Add new patch number below this line */ -+ /**/ -+ 959, - /**/ - - --- -A consultant is a person who takes your money and annoys your employees while -tirelessly searching for the best way to extend the consulting contract. - (Scott Adams - The Dilbert principle) - - /// 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 /// |