]> granicus.if.org Git - vim/commitdiff
patch 8.0.0554: toupper and tolower don't work properly for Turkish v8.0.0554
authorBram Moolenaar <Bram@vim.org>
Sun, 9 Apr 2017 11:41:59 +0000 (13:41 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 9 Apr 2017 11:41:59 +0000 (13:41 +0200)
Problem:    Toupper and tolower don't work properly for Turkish when 'casemap'
            contains "keepascii". (Bjorn Linse)
Solution:   When 'casemap' contains "keepascii" use ASCII toupper/tolower.

src/charset.c
src/testdir/test_normal.vim
src/version.c

index cdb9e48e4e118d48efebcb9a2615b97ac6867953..d649179dd74c3b08afd9f003de74b731eb1dd8ef 100644 (file)
@@ -1733,6 +1733,8 @@ vim_toupper(int c)
        if (enc_latin1like)
            return latin1upper[c];
     }
+    if (c < 0x80 && (cmp_flags & CMP_KEEPASCII))
+       return TOUPPER_ASC(c);
     return TOUPPER_LOC(c);
 }
 
@@ -1757,6 +1759,8 @@ vim_tolower(int c)
        if (enc_latin1like)
            return latin1lower[c];
     }
+    if (c < 0x80 && (cmp_flags & CMP_KEEPASCII))
+       return TOLOWER_ASC(c);
     return TOLOWER_LOC(c);
 }
 #endif
index aa82992a7b4fb17da6811d047e456194f0ff91c9..155ddbfb30230fbe2b94b71487f1903c8dc48e20 100644 (file)
@@ -1619,6 +1619,17 @@ fun! Test_normal30_changecase()
       call assert_equal("i\u0131", getline(1))
       call assert_equal("i\u0131", tolower("iI"))
 
+      set casemap&
+      call setline(1, 'iI')
+      1normal gUU
+      call assert_equal("II", getline(1))
+      call assert_equal("II", toupper("iI"))
+
+      call setline(1, 'iI')
+      1normal guu
+      call assert_equal("ii", getline(1))
+      call assert_equal("ii", tolower("iI"))
+
       lang en_US.UTF-8
     catch /E197:/
       " can't use Turkish locale
index 9fb32c945353d75b17749a4366f7740b8b1edb95..578cfe3bf71e5846a0da2b5c8aa9638f9e707f6a 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    554,
 /**/
     553,
 /**/