diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/buffer.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 16196ec910..1491901877 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -13,6 +13,7 @@ #include "nvim/api/private/defs.h" #include "nvim/vim.h" #include "nvim/buffer.h" +#include "nvim/charset.h" #include "nvim/cursor.h" #include "nvim/memline.h" #include "nvim/memory.h" @@ -933,7 +934,7 @@ Integer nvim_buf_add_highlight(Buffer buffer, return src_id; } -/// Clears highlights from a given source group and a range of lines +/// Clears highlights and virtual text from a given source id and range of lines /// /// To clear a source group in the entire buffer, pass in 0 and -1 to /// line_start and line_end respectively. @@ -976,6 +977,10 @@ void nvim_buf_clear_highlight(Buffer buffer, /// begin after one cell to the right of the ordinary text, this will contain /// the |lcs-eol| char if set, otherwise just be a space. /// +/// The same src_id can be used for both virtual text and highlights added by +/// nvim_buf_add_highlight. Virtual text is cleared using +/// nvim_buf_clear_highlight. +/// /// @param buffer Buffer handle /// @param src_id Source group to use or 0 to use a new group, /// or -1 for a ungrouped annotation @@ -1025,7 +1030,7 @@ Integer nvim_buf_set_virtual_text(Buffer buffer, } String str = chunk.items[0].data.string; - char *text = xstrdup(str.size > 0 ? str.data : ""); + char *text = transstr(str.size > 0 ? str.data : ""); // allocates int hl_id = 0; if (chunk.size == 2) { |