aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/extmark.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-01-28 12:38:56 +0100
committerGitHub <noreply@github.com>2022-01-28 12:38:56 +0100
commitca3e382a4f39c5622fc5e10b784df10b4813fc0e (patch)
tree442ef7a6e523e7b5b4d7f238ef3d2353243ea896 /src/nvim/extmark.c
parent530c65b17ade3f5db70af5746f4eed945efdfcfa (diff)
parent3d9ae9d2dad88a4e2c2263dc7e256657842244c0 (diff)
downloadrneovim-ca3e382a4f39c5622fc5e10b784df10b4813fc0e.tar.gz
rneovim-ca3e382a4f39c5622fc5e10b784df10b4813fc0e.tar.bz2
rneovim-ca3e382a4f39c5622fc5e10b784df10b4813fc0e.zip
Merge pull request #17183 from notomo/expose-extmark-right-gravity
feat(api): expose extmark right_gravity and end_right_gravity
Diffstat (limited to 'src/nvim/extmark.c')
-rw-r--r--src/nvim/extmark.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/nvim/extmark.c b/src/nvim/extmark.c
index cee657c8c9..48e57e20e1 100644
--- a/src/nvim/extmark.c
+++ b/src/nvim/extmark.c
@@ -305,12 +305,14 @@ ExtmarkInfoArray extmark_get(buf_T *buf, uint32_t ns_id, int l_row, colnr_T l_co
}
if (mark.ns == ns_id) {
- mtpos_t endpos = marktree_get_altpos(buf->b_marktree, mark, NULL);
+ mtkey_t end = marktree_get_alt(buf->b_marktree, mark, NULL);
kv_push(array, ((ExtmarkInfo) { .ns_id = mark.ns,
.mark_id = mark.id,
.row = mark.pos.row, .col = mark.pos.col,
- .end_row = endpos.row,
- .end_col = endpos.col,
+ .end_row = end.pos.row,
+ .end_col = end.pos.col,
+ .right_gravity = mt_right(mark),
+ .end_right_gravity = mt_right(end),
.decor = get_decor(mark) }));
}
next_mark:
@@ -326,20 +328,22 @@ next_mark:
// Lookup an extmark by id
ExtmarkInfo extmark_from_id(buf_T *buf, uint32_t ns_id, uint32_t id)
{
- ExtmarkInfo ret = { 0, 0, -1, -1, -1, -1, DECORATION_INIT };
+ ExtmarkInfo ret = { 0, 0, -1, -1, -1, -1, false, false, DECORATION_INIT };
mtkey_t mark = marktree_lookup_ns(buf->b_marktree, ns_id, id, false, NULL);
if (!mark.id) {
return ret;
}
assert(mark.pos.row >= 0);
- mtpos_t endpos = marktree_get_altpos(buf->b_marktree, mark, NULL);
+ mtkey_t end = marktree_get_alt(buf->b_marktree, mark, NULL);
ret.ns_id = ns_id;
ret.mark_id = id;
ret.row = mark.pos.row;
ret.col = mark.pos.col;
- ret.end_row = endpos.row;
- ret.end_col = endpos.col;
+ ret.end_row = end.pos.row;
+ ret.end_col = end.pos.col;
+ ret.right_gravity = mt_right(mark);
+ ret.end_right_gravity = mt_right(end);
ret.decor = get_decor(mark);
return ret;