aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/map.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-09-08 09:47:10 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2020-11-01 19:14:56 +0100
commitc146eddc8b768f1cd395ea0ce54c19e64eff0c08 (patch)
treeda1fe59768dcc60901da66b18d848b2d81b6e072 /src/nvim/map.c
parent037ffd54dcd8edba6787d93273e6696b7a366ac6 (diff)
downloadrneovim-c146eddc8b768f1cd395ea0ce54c19e64eff0c08.tar.gz
rneovim-c146eddc8b768f1cd395ea0ce54c19e64eff0c08.tar.bz2
rneovim-c146eddc8b768f1cd395ea0ce54c19e64eff0c08.zip
api: add API for themes
co-author: hlpr98 <hlpr98@gmail.com> (dict2hlattrs function) orange is sus?? NOVEMBER DAWN erase the lie that is redraw_later()
Diffstat (limited to 'src/nvim/map.c')
-rw-r--r--src/nvim/map.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/map.c b/src/nvim/map.c
index ca8ea76333..7d97b7f13d 100644
--- a/src/nvim/map.c
+++ b/src/nvim/map.c
@@ -12,6 +12,9 @@
#include <stdbool.h>
#include <string.h>
+#include <lua.h>
+#include <lauxlib.h>
+
#include "nvim/map.h"
#include "nvim/map_defs.h"
#include "nvim/vim.h"
@@ -173,6 +176,20 @@ static inline bool HlEntry_eq(HlEntry ae1, HlEntry ae2)
return memcmp(&ae1, &ae2, sizeof(ae1)) == 0;
}
+static inline khint_t ColorKey_hash(ColorKey ae)
+{
+ const uint8_t *data = (const uint8_t *)&ae;
+ khint_t h = 0;
+ for (size_t i = 0; i < sizeof(ae); i++) {
+ h = (h << 5) - h + data[i];
+ }
+ return h;
+}
+
+static inline bool ColorKey_eq(ColorKey ae1, ColorKey ae2)
+{
+ return memcmp(&ae1, &ae2, sizeof(ae1)) == 0;
+}
MAP_IMPL(int, int, DEFAULT_INITIALIZER)
@@ -191,6 +208,7 @@ MAP_IMPL(String, MsgpackRpcRequestHandler, MSGPACK_HANDLER_INITIALIZER)
MAP_IMPL(HlEntry, int, DEFAULT_INITIALIZER)
MAP_IMPL(String, handle_T, 0)
+MAP_IMPL(ColorKey, ColorItem, COLOR_ITEM_INITIALIZER)
/// Deletes a key:value pair from a string:pointer map, and frees the
/// storage of both key and value.