aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-13 07:38:12 +0800
committerGitHub <noreply@github.com>2024-02-13 07:38:12 +0800
commit4860cc5bdcde60994ac331c0c985acdf15115ca8 (patch)
tree207919a4a88c993e256dcad8a082c9a2eb90d2cd /src/nvim/ops.c
parent86458dde0e451dc1d59f16f1d00f2abeb8288ac9 (diff)
downloadrneovim-4860cc5bdcde60994ac331c0c985acdf15115ca8.tar.gz
rneovim-4860cc5bdcde60994ac331c0c985acdf15115ca8.tar.bz2
rneovim-4860cc5bdcde60994ac331c0c985acdf15115ca8.zip
vim-patch:9.1.0101: upper-case of German sharp s should be U+1E9E (#27449)
Problem: upper-case of ß should be U+1E9E (CAPITAL LETTER SHARP S) (fenuks) Solution: Make gU, ~ and g~ convert the U+00DF LATIN SMALL LETTER SHARP S (ß) to U+1E9E LATIN CAPITAL LETTER SHARP S (ẞ), update tests (glepnir) This is part of Unicode 5.1.0 from April 2008, so should be fairly safe to use now and since 2017 is part of the German standard orthography, according to Wikipedia: https://en.wikipedia.org/wiki/Capital_%E1%BA%9E#cite_note-auto-12 There is however one exception: UnicodeData.txt for U+00DF LATIN SMALL LETTER SHARP S does NOT define U+1E9E LATIN CAPITAL LETTER SHARP S as its upper case version. Therefore, toupper() won't be able to convert from lower sharp s to upper case sharp s (the other way around however works, since U+00DF is considered the lower case character of U+1E9E and therefore tolower() works correctly for the upper case version). fixes: vim/vim#5573 closes: vim/vim#14018 https://github.com/vim/vim/commit/bd1232a1faf56b614a1e74c4ce51bc6e0650ae00 Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index d785be54e5..f91df49e4f 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -2165,16 +2165,16 @@ bool swapchar(int op_type, pos_T *pos)
return false;
}
- if (op_type == OP_UPPER && c == 0xdf) {
+ // ~ is OP_NOP, g~ is OP_TILDE, gU is OP_UPPER
+ if ((op_type == OP_UPPER || op_type == OP_NOP || op_type == OP_TILDE) && c == 0xdf) {
pos_T sp = curwin->w_cursor;
- // Special handling of German sharp s: change to "SS".
+ // Special handling for lowercase German sharp s (ß): convert to uppercase (ẞ).
curwin->w_cursor = *pos;
del_char(false);
- ins_char('S');
- ins_char('S');
+ ins_char(0x1E9E);
curwin->w_cursor = sp;
- inc(pos);
+ return true;
}
int nc = c;