aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-03-20 18:59:20 +0100
committerGitHub <noreply@github.com>2022-03-20 18:59:20 +0100
commite7391191e27768dc6d603f3846d9b4e09c003cb5 (patch)
tree6f3782c905dfe1ee23939fc7353b876fe26095e9 /src/nvim/api
parentaf427dedf663b1987fa54c5f885409ad51824a20 (diff)
parent6eca9b69c4a1f40f27a6b41961af787327259de8 (diff)
downloadrneovim-e7391191e27768dc6d603f3846d9b4e09c003cb5.tar.gz
rneovim-e7391191e27768dc6d603f3846d9b4e09c003cb5.tar.bz2
rneovim-e7391191e27768dc6d603f3846d9b4e09c003cb5.zip
Merge pull request #17776 from bfredl/tsconceal
feat(ui): allow conceal to be defined in decorations
Diffstat (limited to 'src/nvim/api')
-rw-r--r--src/nvim/api/extmark.c16
-rw-r--r--src/nvim/api/keysets.lua1
2 files changed, 17 insertions, 0 deletions
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index c02688a815..797b64e2af 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -467,6 +467,11 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e
/// as the mark and 'cursorline' is enabled.
/// Note: ranges are unsupported and decorations are only
/// applied to start_row
+/// - conceal: string which should be either empty or a single
+/// character. Enable concealing similar to |:syn-conceal|.
+/// When a character is supplied it is used as |:syn-cchar|.
+/// "hl_group" is used as highlight for the cchar if provided,
+/// otherwise it defaults to |hl-Conceal|.
///
/// @param[out] err Error details, if any
/// @return Id of the created/updated extmark
@@ -563,6 +568,17 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
}
}
+ if (opts->conceal.type == kObjectTypeString) {
+ String c = opts->conceal.data.string;
+ decor.conceal = true;
+ if (c.size) {
+ decor.conceal_char = utf_ptr2char((const char_u *)c.data);
+ }
+ } else if (HAS_KEY(opts->conceal)) {
+ api_set_error(err, kErrorTypeValidation, "conceal is not a String");
+ goto error;
+ }
+
if (opts->virt_text.type == kObjectTypeArray) {
decor.virt_text = parse_virt_text(opts->virt_text.data.array, err,
&decor.virt_text_width);
diff --git a/src/nvim/api/keysets.lua b/src/nvim/api/keysets.lua
index 435e8195dd..b6264cdfab 100644
--- a/src/nvim/api/keysets.lua
+++ b/src/nvim/api/keysets.lua
@@ -27,6 +27,7 @@ return {
"number_hl_group";
"line_hl_group";
"cursorline_hl_group";
+ "conceal";
};
keymap = {
"noremap";