diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2020-11-25 12:43:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-25 12:43:08 +0100 |
commit | ca7fa2a43ad0660a53653519b411f7f0df11bd22 (patch) | |
tree | 976ed7cad8f78382a6838513d37c44369ca677f5 /src/nvim/api/buffer.c | |
parent | ea3aaa020fee3265e972aaff15f38959d76d875e (diff) | |
parent | c0a6989d93d35811411155e43f37b2fc4658719e (diff) | |
download | rneovim-ca7fa2a43ad0660a53653519b411f7f0df11bd22.tar.gz rneovim-ca7fa2a43ad0660a53653519b411f7f0df11bd22.tar.bz2 rneovim-ca7fa2a43ad0660a53653519b411f7f0df11bd22.zip |
Merge pull request #13357 from vigoux/luahl-priority
feat(luahl): add priority mechanism
Diffstat (limited to 'src/nvim/api/buffer.c')
-rw-r--r-- | src/nvim/api/buffer.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 4fc0ee4fdf..1011f050fd 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -1122,6 +1122,8 @@ static Array extmark_to_array(ExtmarkInfo extmark, bool id, bool add_dict) } PUT(dict, "virt_text", ARRAY_OBJ(chunks)); } + + PUT(dict, "priority", INTEGER_OBJ(decor->priority)); } if (dict.size) { @@ -1375,6 +1377,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, uint64_t id = 0; int line2 = -1, hl_id = 0; + DecorPriority priority = DECOR_PRIORITY_BASE; colnr_T col2 = 0; VirtText virt_text = KV_INITIAL_VALUE; for (size_t i = 0; i < opts.size; i++) { @@ -1446,6 +1449,19 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, if (ERROR_SET(err)) { goto error; } + } else if (strequal("priority", k.data)) { + if (v->type != kObjectTypeInteger) { + api_set_error(err, kErrorTypeValidation, + "priority is not a Number of the correct size"); + goto error; + } + + if (v->data.integer < 0 || v->data.integer > UINT16_MAX) { + api_set_error(err, kErrorTypeValidation, + "priority is not a valid value"); + goto error; + } + priority = (DecorPriority)v->data.integer; } else { api_set_error(err, kErrorTypeValidation, "unexpected key: %s", k.data); goto error; @@ -1479,7 +1495,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, *vt_allocated = virt_text; } decor_add_ephemeral(attr_id, (int)line, (colnr_T)col, - (int)line2, (colnr_T)col2, vt_allocated); + (int)line2, (colnr_T)col2, priority, vt_allocated); } else { if (ephemeral) { api_set_error(err, kErrorTypeException, "not yet implemented"); @@ -1492,6 +1508,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, decor->virt_text = virt_text; } else if (hl_id) { decor = decor_hl(hl_id); + decor->priority = priority; } id = extmark_set(buf, (uint64_t)ns_id, id, (int)line, (colnr_T)col, |