aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/buffer.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-01-21 13:50:22 +0100
committerThomas Vigouroux <tomvig38@gmail.com>2020-09-03 10:23:52 +0200
commit54ce1010e86cbb29067aabfc332dab59b5a88edb (patch)
tree7c1ef5abd9ae4f55c02c733fdbfababa3ad2e848 /src/nvim/api/buffer.c
parent3acfefb63ee70c8eac13bf6b308a0e73e6fb8007 (diff)
downloadrneovim-54ce1010e86cbb29067aabfc332dab59b5a88edb.tar.gz
rneovim-54ce1010e86cbb29067aabfc332dab59b5a88edb.tar.bz2
rneovim-54ce1010e86cbb29067aabfc332dab59b5a88edb.zip
extmark: refiy "Decoration" abstraction
one very important thought
Diffstat (limited to 'src/nvim/api/buffer.c')
-rw-r--r--src/nvim/api/buffer.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 8e61976c4b..e813fc1dd4 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -1318,7 +1318,8 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer id,
}
id_num = extmark_set(buf, (uint64_t)ns_id, id_num,
- (int)line, (colnr_T)col, kExtmarkUndo);
+ (int)line, (colnr_T)col,
+ -1, -1, NULL, kExtmarkUndo);
return (Integer)id_num;
}
@@ -1425,10 +1426,13 @@ Integer nvim_buf_add_highlight(Buffer buffer,
end_line++;
}
- extmark_add_decoration(buf, ns_id, hlg_id,
- (int)line, (colnr_T)col_start,
- end_line, (colnr_T)col_end,
- VIRTTEXT_EMPTY);
+ Decoration *decor = xcalloc(1, sizeof(*decor));
+ decor->hl_id = hlg_id;
+
+ ns_id = extmark_set(buf, ns_id, 0,
+ (int)line, (colnr_T)col_start,
+ end_line, (colnr_T)col_end,
+ decor, kExtmarkUndo);
return src_id;
}
@@ -1592,9 +1596,10 @@ Integer nvim_buf_set_virtual_text(Buffer buffer,
return src_id;
}
- extmark_add_decoration(buf, ns_id, 0,
- (int)line, 0, -1, -1,
- virt_text);
+ Decoration *decor = xcalloc(1, sizeof(*decor));
+ decor->virt_text = virt_text;
+
+ extmark_set(buf, ns_id, 0, (int)line, 0, -1, -1, decor, kExtmarkUndo);
return src_id;
}
@@ -1695,9 +1700,14 @@ Integer nvim__buf_add_decoration(Buffer buffer, Integer ns_id, String hl_group,
return 0;
}
- uint64_t mark_id = extmark_add_decoration(buf, (uint64_t)ns_id, hlg_id,
- (int)start_row, (colnr_T)start_col,
- (int)end_row, (colnr_T)end_col, vt);
+ Decoration *decor = xcalloc(1, sizeof(*decor));
+ decor->hl_id = hlg_id;
+ decor->virt_text = vt;
+
+ uint64_t mark_id = extmark_set(buf, (uint64_t)ns_id, 0,
+ (int)start_row, (colnr_T)start_col,
+ (int)end_row, (colnr_T)end_col, decor,
+ kExtmarkUndo);
return (Integer)mark_id;
}