diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-10-13 15:42:43 +0200 |
|---|---|---|
| committer | Randy Palamar <palamar@ualberta.ca> | 2023-10-15 08:17:23 -0600 |
| commit | be89a6450ef92233ac8eacd120c49739bd37e65f (patch) | |
| tree | 54b97a6610bb9a891437c70aeede5c419324391a /lua/vis-std.lua | |
| parent | aa18162e2d62d1a4a618ee65289ba8b1cdeaf29a (diff) | |
| download | vis-be89a6450ef92233ac8eacd120c49739bd37e65f.tar.gz vis-be89a6450ef92233ac8eacd120c49739bd37e65f.tar.xz | |
view: skip empty cells before applying a style
The view_style function is used to apply styles to ranges of text in
a view. It approaches the starting position where the style should be
applied by iterating the columns in the appropriate line using
this while loop:
while (pos < start && col < width)
pos += line->cells[col++].len;
The while loop will stop at the last character before the range where
the style should be applied.
This works fine until we encounter "empty" cells between the last
cell containing an actual character and the first cell to be styled.
This can happen if the last character before the range to style is
'\t' which gets expanded with empty cells by vis according to the
tabwidth option. Those empty cells get erroneously styled as well.
This is fixed by skipping all empty cells encountered before the
range to style.
fixes #1147: `win:style` styles more terminal cells than expected
Diffstat (limited to 'lua/vis-std.lua')
0 files changed, 0 insertions, 0 deletions
