diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-05-03 16:59:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 16:59:24 +0200 |
commit | 4df11463b288a227a7052b7fd9c0a3f737a51c1e (patch) | |
tree | 0b715c8dd093763d480cc62ae3873d7abf4b9047 /src/nvim/api/extmark.c | |
parent | 70e2c5d10d2574b77c56d0bebeb61527876ff0b1 (diff) | |
parent | 29a6cda3ffe981b09d4c59d49d6c97a4ea13ca8b (diff) | |
download | rneovim-4df11463b288a227a7052b7fd9c0a3f737a51c1e.tar.gz rneovim-4df11463b288a227a7052b7fd9c0a3f737a51c1e.tar.bz2 rneovim-4df11463b288a227a7052b7fd9c0a3f737a51c1e.zip |
Merge pull request #15674 from yatli/ui_event_extmark
API/UI: ui_event_extmark
Diffstat (limited to 'src/nvim/api/extmark.c')
-rw-r--r-- | src/nvim/api/extmark.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index e408d88854..fa6923e6d5 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -146,6 +146,10 @@ static Array extmark_to_array(ExtmarkInfo extmark, bool id, bool add_dict) STRING_OBJ(cstr_to_string(virt_text_pos_str[decor->virt_text_pos]))); } + if (decor->ui_watched) { + PUT(dict, "ui_watched", BOOLEAN_OBJ(true)); + } + if (kv_size(decor->virt_lines)) { Array all_chunks = ARRAY_DICT_INIT; bool virt_lines_leftcol = false; @@ -170,7 +174,7 @@ static Array extmark_to_array(ExtmarkInfo extmark, bool id, bool add_dict) PUT(dict, "virt_lines_leftcol", BOOLEAN_OBJ(virt_lines_leftcol)); } - if (decor->hl_id || kv_size(decor->virt_text)) { + if (decor->hl_id || kv_size(decor->virt_text) || decor->ui_watched) { PUT(dict, "priority", INTEGER_OBJ(decor->priority)); } @@ -472,6 +476,10 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e /// 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|. +/// - ui_watched: boolean that indicates the mark should be drawn +/// by a UI. When set, the UI will receive win_extmark events. +/// Note: the mark is positioned by virt_text attributes. Can be +/// used together with virt_text. /// /// @param[out] err Error details, if any /// @return Id of the created/updated extmark @@ -709,6 +717,8 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer bool ephemeral = false; OPTION_TO_BOOL(ephemeral, ephemeral, false); + OPTION_TO_BOOL(decor.ui_watched, ui_watched, false); + if (line < 0) { api_set_error(err, kErrorTypeValidation, "line value outside range"); goto error; @@ -762,7 +772,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer // TODO(bfredl): synergize these two branches even more if (ephemeral && decor_state.buf == buf) { - decor_add_ephemeral((int)line, (int)col, line2, col2, &decor); + decor_add_ephemeral((int)line, (int)col, line2, col2, &decor, (uint64_t)ns_id, id); } else { if (ephemeral) { api_set_error(err, kErrorTypeException, "not yet implemented"); |