diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-08 08:22:10 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-08 20:03:40 +0800 |
commit | 53c9500c1dc95eb446e13e857a7d6a7642d859ab (patch) | |
tree | 946d02a98892a060d659c7eacce9b65062eb936b /runtime | |
parent | bc8fbb7c1de0e5cbc8650be883a675bdc3e9d7d8 (diff) | |
download | rneovim-53c9500c1dc95eb446e13e857a7d6a7642d859ab.tar.gz rneovim-53c9500c1dc95eb446e13e857a7d6a7642d859ab.tar.bz2 rneovim-53c9500c1dc95eb446e13e857a7d6a7642d859ab.zip |
vim-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().
https://github.com/vim/vim/commit/08aac3c6192f0103cb87e280270a32b50e653be1
Co-Authored-By: delphinus <me@delphinus.dev>
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/builtin.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/builtin.txt b/runtime/doc/builtin.txt index c56ab70774..447f1c89e2 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -396,6 +396,7 @@ setbufline({expr}, {lnum}, {text}) Number set line {lnum} to {text} in buffer {expr} setbufvar({buf}, {varname}, {val}) set {varname} in buffer {buf} to {val} +setcellwidths({list}) none set character cell width overrides setcharpos({expr}, {list}) Number set the {expr} position to {list} setcharsearch({dict}) Dict set character search from {dict} setcmdpos({pos}) Number set cursor position in command-line @@ -6817,6 +6818,29 @@ setbufvar({buf}, {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([]); + + setcharpos({expr}, {list}) *setcharpos()* Same as |setpos()| but uses the specified column number as the character index instead of the byte index in the line. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 9d03397821..28922e9c7f 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -591,7 +591,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 008b9b4e58..bc2f7f077b 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -619,6 +619,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 |