patch 8.0.0554: toupper and tolower don't work properly for Turkish
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.
diff --git a/src/charset.c b/src/charset.c
index cdb9e48..d649179 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1733,6 +1733,8 @@
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 @@
if (enc_latin1like)
return latin1lower[c];
}
+ if (c < 0x80 && (cmp_flags & CMP_KEEPASCII))
+ return TOLOWER_ASC(c);
return TOLOWER_LOC(c);
}
#endif
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index aa82992..155ddbf 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -1619,6 +1619,17 @@
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
diff --git a/src/version.c b/src/version.c
index 9fb32c9..578cfe3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 554,
+/**/
553,
/**/
552,