patch 8.2.1535: it is not possible to specify cell widths of characters
Problem: It is not possible to specify cell widths of characters.
Solution: Add setcellwidths().
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 09ef979..129c1e2 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2768,6 +2768,7 @@
{expr}
setbufvar({expr}, {varname}, {val})
none set {varname} in buffer {expr} to {val}
+setcellwidths({list}) none set character cell width overrides
setcharsearch({dict}) Dict set character search from {dict}
setcmdpos({pos}) Number set cursor position in command-line
setenv({name}, {val}) none set environment variable
@@ -8937,6 +8938,29 @@
third argument: >
GetValue()->setbufvar(buf, varname)
+
+setcellwidths({list}) *setcellwidths()*
+ Specify overrides for cell widths of character ranges. This
+ tells Vim how wide characters are, counted in screen cells.
+ This overrides 'ambiwidth'. Example: >
+ setcellwidths([[0xad, 0xad, 1],
+ \ [0x2194, 0x2199, 2]]
+
+< *E1109* *E1110* *E1111* *E1112* *E1113*
+ The {list} argument is a list of lists with each three
+ numbers. These three numbers are [low, high, width]. "low"
+ and "high" can be the same, in which case this refers to one
+ character. Otherwise it is the range of characters from "low"
+ to "high" (inclusive). "width" is either 1 or 2, indicating
+ the character width in screen cells.
+ An error is given if the argument is invalid, also when a
+ range overlaps with another.
+ Only characters with value 0x100 and higher can be used.
+
+ To clear the overrides pass an empty list: >
+ setcellwidths([]);
+
+
setcharsearch({dict}) *setcharsearch()*
Set the current character search information to {dict},
which contains one or more of the following entries:
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index b463e75..de8dd48 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -701,7 +701,9 @@
"double": Use twice the width of ASCII characters.
*E834* *E835*
The value "double" cannot be used if 'listchars' or 'fillchars'
- contains a character that would be double width.
+
+ The values are overruled for characters specified with
+ |setcellwidths()|.
There are a number of CJK fonts for which the width of glyphs for
those characters are solely based on how many octets they take in
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 459f6b0..bcd58c9 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -611,6 +611,7 @@
strchars() length of a string in characters
strwidth() size of string when displayed
strdisplaywidth() size of string when displayed, deals with tabs
+ setcellwidths() set character cell width overrides
substitute() substitute a pattern match with a string
submatch() get a specific match in ":s" and substitute()
strpart() get part of a string using byte index