From 754892e59dc3ab65a92d22f315e88b716bc26d1d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 Aug 2022 11:29:38 +0800 Subject: vim-patch:8.2.{1536,1540}: charclass() (#19748) vim-patch:8.2.1536: cannot get the class of a character; emoji widths are wrong Problem: Cannot get the class of a character; emoji widths are wrong in some environments. Solution: Add charclass(). Update some emoji widths. Add script to check emoji widths. https://github.com/vim/vim/commit/4e4473c927167fd24e5c8df90e0e8035080cf2da Use latest charclass() docs from Vim. Rewrite DoIt() in emoji_list.vim in Lua. Omit emoji table updates: - emoji_width update looks wrong as these added ranges are only double-width when followed by 0xFE0F. - Other updates are too old. vim-patch:8.2.1540: the user cannot try out emoji character widths Problem: The user cannot try out emoji character widths. Solution: Move the emoji script to the runtime/tools directory. https://github.com/vim/vim/commit/98945560c1ae6e2ddee820a7de718a36e3f4b6e5 --- runtime/doc/builtin.txt | 15 ++++++++++++++- runtime/doc/usr_41.txt | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index d0b28ce875..719953bc22 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -77,6 +77,7 @@ changenr() Number current change number chanclose({id} [, {stream}]) Number Closes a channel or one of its streams chansend({id}, {data}) Number Writes {data} to channel char2nr({expr} [, {utf8}]) Number ASCII/UTF-8 value of first char in {expr} +charclass({string}) Number character class of {string} charcol({expr}) Number column number of cursor or mark charidx({string}, {idx} [, {countcc}]) Number char index of byte {idx} in {string} @@ -1064,7 +1065,19 @@ char2nr({string} [, {utf8}]) *char2nr()* Can also be used as a |method|: > GetChar()->char2nr() -< + +charclass({string}) *charclass()* + Return the character class of the first character in {string}. + The character class is one of: + 0 blank + 1 punctuation + 2 word character + 3 emoji + other specific Unicode class + The class is used in patterns and word motions. + Returns 0 if {string} is not a |String|. + + *charcol()* charcol({expr}) Same as |col()| but returns the character index of the column position given with {expr} instead of the byte position. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 235925c033..0c907bfb68 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -606,6 +606,7 @@ String manipulation: *string-functions* strtrans() translate a string to make it printable tolower() turn a string to lowercase toupper() turn a string to uppercase + charclass() class of a character match() position where a pattern matches in a string matchend() position where a pattern match ends in a string matchfuzzy() fuzzy matches a string in a list of strings -- cgit