aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2017-06-23 09:56:35 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2018-11-24 11:01:37 +0100
commit01dbf0951b25d582451a8e656731dcf3d9295a71 (patch)
tree40d9b5b3fee2829baf8c3ab5fa38cf8d0629d7ce /src/nvim/buffer.c
parent108566e7b6f1b331dac8e339280c230bf39c137d (diff)
downloadrneovim-01dbf0951b25d582451a8e656731dcf3d9295a71.tar.gz
rneovim-01dbf0951b25d582451a8e656731dcf3d9295a71.tar.bz2
rneovim-01dbf0951b25d582451a8e656731dcf3d9295a71.zip
api: implement object namespaces
Namespaces is a lightweight concept that should be used to group objects for purposes of bulk operations and introspection. This is initially used for highlights and virtual text in buffers, and is planned to also be used for extended marks. There is no plan use them for privileges or isolation, neither to introduce nanespace-level options.
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index cd77f48320..634e257d40 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -26,6 +26,7 @@
#include "nvim/api/private/handle.h"
#include "nvim/api/private/helpers.h"
+#include "nvim/api/vim.h"
#include "nvim/ascii.h"
#include "nvim/assert.h"
#include "nvim/vim.h"
@@ -5327,10 +5328,10 @@ int bufhl_add_hl(buf_T *buf,
int hl_id,
linenr_T lnum,
colnr_T col_start,
- colnr_T col_end) {
- static int next_src_id = 1;
+ colnr_T col_end)
+{
if (src_id == 0) {
- src_id = next_src_id++;
+ src_id = (int)nvim_create_namespace((String)STRING_INIT);
}
if (hl_id <= 0) {
// no highlight group or invalid line, just return src_id