aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/extmark.c
diff options
context:
space:
mode:
authornotomo <notomo.motono@gmail.com>2022-01-24 09:52:13 +0900
committernotomo <notomo.motono@gmail.com>2022-01-24 09:52:13 +0900
commit3d9ae9d2dad88a4e2c2263dc7e256657842244c0 (patch)
treec6374905f58e7f3a089736e877eaf7a236a95ee8 /src/nvim/extmark.c
parent7e2ce35e3b7f8be5e8d01b44c2fdba0b4e23fbd4 (diff)
downloadrneovim-3d9ae9d2dad88a4e2c2263dc7e256657842244c0.tar.gz
rneovim-3d9ae9d2dad88a4e2c2263dc7e256657842244c0.tar.bz2
rneovim-3d9ae9d2dad88a4e2c2263dc7e256657842244c0.zip
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;