Patch 8.2.4451 (after 8.2.4450)
Problem: sort() fails when ignoring case.
Solution: Accept a number one argument in sort().
Files: src/evalfunc.c, src/testdir/test_listdict.vim
*** ../vim-8.2.4450/src/evalfunc.c 2022-02-22 21:54:41.175163303 +0000
--- src/evalfunc.c 2022-02-22 22:52:18.588781782 +0000
***************
*** 603,608 ****
--- 603,609 ----
{
if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
+ || type->tt_type == VAR_NUMBER // 1 means ignore case
|| type == &t_unknown
|| type == &t_any)
return OK;
*** ../vim-8.2.4450/src/testdir/test_listdict.vim 2022-02-22
22:16:56.570274341 +0000
--- src/testdir/test_listdict.vim 2022-02-22 22:50:07.137155645 +0000
***************
*** 934,942 ****
" Tests for reverse(), sort(), uniq()
func Test_reverse_sort_uniq()
- func g:RetOne()
- return 1
- endfunc
let lines =<< trim END
VAR l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2],
'x8', [0, 1, 2], 1.5]
call assert_equal(['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0,
1, 2], 'x8', [0, 1, 2], 1.5], uniq(copy(l)))
--- 934,939 ----
***************
*** 952,964 ****
call assert_equal([-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22,
7, 9, 12, 18, 22, 255], sort(copy(l), 'n'))
LET l = [7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar',
'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []]
! call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo',
'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}],
sort(copy(l), g:RetOne()))
call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo',
'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}],
sort(copy(l), 'i'))
call assert_equal(['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar',
'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l)))
endif
END
call v9.CheckLegacyAndVim9Success(lines)
- delfunc g:RetOne
call assert_fails('call reverse("")', 'E899:')
call assert_fails('call uniq([1, 2], {x, y -> []})', 'E745:')
--- 949,960 ----
call assert_equal([-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22,
7, 9, 12, 18, 22, 255], sort(copy(l), 'n'))
LET l = [7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar',
'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []]
! call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo',
'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}],
sort(copy(l), 1))
call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo',
'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}],
sort(copy(l), 'i'))
call assert_equal(['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar',
'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l)))
endif
END
call v9.CheckLegacyAndVim9Success(lines)
call assert_fails('call reverse("")', 'E899:')
call assert_fails('call uniq([1, 2], {x, y -> []})', 'E745:')
*** ../vim-8.2.4450/src/version.c 2022-02-22 22:16:56.574274337 +0000
--- src/version.c 2022-02-22 22:51:43.632877899 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4451,
/**/
--
>From "know your smileys":
%-) After staring at the screen for 15 hours
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220222225436.A40441C14C0%40moolenaar.net.