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.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 129c1e2..e0c8473 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2425,6 +2425,7 @@
String status of channel {handle}
changenr() Number current change number
char2nr({expr} [, {utf8}]) Number ASCII/UTF8 value of first char in {expr}
+charclass({string}) Number character class of {string}
chdir({dir}) String change current working directory
cindent({lnum}) Number C indent for line {lnum}
clearmatches([{win}]) none clear all matches
@@ -3520,6 +3521,18 @@
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.
+
+
chdir({dir}) *chdir()*
Change the current working directory to {dir}. The scope of
the directory change depends on the directory of the current
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index bcd58c9..10e53ba 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -600,6 +600,7 @@
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
matchstr() match of a pattern in a string