To: vim_dev@googlegroups.com Subject: Patch 8.0.0552 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0552 Problem: Toupper and tolower don't work properly for Turkish when 'casemap' is empty. (Bjorn Linse) Solution: Check the 'casemap' options when deciding how to upper/lower case. Files: src/charset.c, src/testdir/test_normal.vim *** ../vim-8.0.0551/src/charset.c 2017-03-12 21:31:54.289925047 +0100 --- src/charset.c 2017-04-08 19:00:06.124834223 +0200 *************** *** 960,966 **** } /* ! * return TRUE if 'c' is a printable character * Assume characters above 0x100 are printable (multi-byte), except for * Unicode. */ --- 960,966 ---- } /* ! * Return TRUE if 'c' is a printable character. * Assume characters above 0x100 are printable (multi-byte), except for * Unicode. */ *************** *** 1717,1723 **** { if (c <= '@') return c; ! if (c >= 0x80) { if (enc_utf8) return utf_toupper(c); --- 1717,1723 ---- { if (c <= '@') return c; ! if (c >= 0x80 || !(cmp_flags & CMP_KEEPASCII)) { if (enc_utf8) return utf_toupper(c); *************** *** 1741,1747 **** { if (c <= '@') return c; ! if (c >= 0x80) { if (enc_utf8) return utf_tolower(c); --- 1741,1747 ---- { if (c <= '@') return c; ! if (c >= 0x80 || !(cmp_flags & CMP_KEEPASCII)) { if (enc_utf8) return utf_tolower(c); *** ../vim-8.0.0551/src/testdir/test_normal.vim 2017-04-07 20:09:47.311773995 +0200 --- src/testdir/test_normal.vim 2017-04-08 19:01:20.056373081 +0200 *************** *** 1603,1608 **** --- 1603,1628 ---- norm! V~ call assert_equal('THIS IS A simple test: äüöss', getline('.')) + " Turkish ASCII turns to multi-byte. + try + lang tr_TR.UTF-8 + set casemap= + call setline(1, 'iI') + 1normal gUU + call assert_equal("\u0130I", getline(1)) + call assert_equal("\u0130I", toupper("iI")) + + call setline(1, 'iI') + 1normal guu + call assert_equal("i\u0131", getline(1)) + call assert_equal("i\u0131", tolower("iI")) + + lang en_US.UTF-8 + catch /E197:/ + " can't use Turkish locale + throw 'Skipped: Turkish locale not available' + endtry + " clean up bw! endfunc *** ../vim-8.0.0551/src/version.c 2017-04-08 18:41:07.339941299 +0200 --- src/version.c 2017-04-08 19:10:57.584769418 +0200 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 552, /**/ -- Facepalm reply #9: "Speed up, you can drive 80 here" "Why, the cars behind us are also driving 60" /// 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 ///