Skip to content

Commit 1cc4820

Browse files
committed
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.
1 parent 9f4de1f commit 1cc4820

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/charset.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,8 @@ vim_toupper(int c)
17331733
if (enc_latin1like)
17341734
return latin1upper[c];
17351735
}
1736+
if (c < 0x80 && (cmp_flags & CMP_KEEPASCII))
1737+
return TOUPPER_ASC(c);
17361738
return TOUPPER_LOC(c);
17371739
}
17381740

@@ -1757,6 +1759,8 @@ vim_tolower(int c)
17571759
if (enc_latin1like)
17581760
return latin1lower[c];
17591761
}
1762+
if (c < 0x80 && (cmp_flags & CMP_KEEPASCII))
1763+
return TOLOWER_ASC(c);
17601764
return TOLOWER_LOC(c);
17611765
}
17621766
#endif

src/testdir/test_normal.vim

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,17 @@ fun! Test_normal30_changecase()
16191619
call assert_equal("i\u0131", getline(1))
16201620
call assert_equal("i\u0131", tolower("iI"))
16211621

1622+
set casemap&
1623+
call setline(1, 'iI')
1624+
1normal gUU
1625+
call assert_equal("II", getline(1))
1626+
call assert_equal("II", toupper("iI"))
1627+
1628+
call setline(1, 'iI')
1629+
1normal guu
1630+
call assert_equal("ii", getline(1))
1631+
call assert_equal("ii", tolower("iI"))
1632+
16221633
lang en_US.UTF-8
16231634
catch /E197:/
16241635
" can't use Turkish locale

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
554,
767769
/**/
768770
553,
769771
/**/

0 commit comments

Comments
 (0)