mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 02:16:31 +00:00
feat(extmarks): add virt_text_repeat_linebreak flag (#26625)
Problem: Unable to predict which byte-offset to place virtual text to make it repeat visually in the wrapped part of a line. Solution: Add a flag to nvim_buf_set_extmark() that causes virtual text to repeat in wrapped lines.
This commit is contained in:
@@ -391,6 +391,8 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e
|
||||
/// text is selected or hidden because of
|
||||
/// scrolling with 'nowrap' or 'smoothscroll'.
|
||||
/// Currently only affects "overlay" virt_text.
|
||||
/// - virt_text_repeat_linebreak : repeat the virtual text on
|
||||
/// wrapped lines.
|
||||
/// - hl_mode : control how highlights are combined with the
|
||||
/// highlights of the text. Currently only affects
|
||||
/// virt_text highlights, but might affect `hl_group`
|
||||
@@ -613,7 +615,8 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
|
||||
}
|
||||
|
||||
hl.flags |= opts->hl_eol ? kSHHlEol : 0;
|
||||
virt_text.flags |= opts->virt_text_hide ? kVTHide : 0;
|
||||
virt_text.flags |= ((opts->virt_text_hide ? kVTHide : 0)
|
||||
| (opts->virt_text_repeat_linebreak ? kVTRepeatLinebreak : 0));
|
||||
|
||||
if (HAS_KEY(opts, set_extmark, hl_mode)) {
|
||||
String str = opts->hl_mode;
|
||||
|
@@ -33,6 +33,7 @@ typedef struct {
|
||||
String virt_text_pos;
|
||||
Integer virt_text_win_col;
|
||||
Boolean virt_text_hide;
|
||||
Boolean virt_text_repeat_linebreak;
|
||||
Boolean hl_eol;
|
||||
String hl_mode;
|
||||
Boolean invalidate;
|
||||
|
Reference in New Issue
Block a user