diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-08-28 21:04:24 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-08-28 21:04:24 +0200 |
commit | 08aac3c6192f0103cb87e280270a32b50e653be1 (patch) | |
tree | ea2842918dbdaab787aec93332fd6db4816c684c /runtime | |
parent | ee8580e52e767916e2a95e8ac0732fd8a5ae0651 (diff) |
patch 8.2.1535: it is not possible to specify cell widths of charactersv8.2.1535
Problem: It is not possible to specify cell widths of characters.
Solution: Add setcellwidths().
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 24 | ||||
-rw-r--r-- | runtime/doc/options.txt | 4 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 1 |
3 files changed, 28 insertions, 1 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 09ef979638..129c1e2e2c 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2768,6 +2768,7 @@ setbufline({expr}, {lnum}, {text}) {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 @@ setbufvar({expr}, {varname}, {val}) *setbufvar()* 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 b463e75c4a..de8dd487f6 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -701,7 +701,9 @@ A jump table for the options with a short description can be found at |Q_op|. "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 459f6b016d..bcd58c9fec 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -611,6 +611,7 @@ String manipulation: *string-functions* 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 |