diff options
author | Corey Williamson <euclidianAce@protonmail.com> | 2021-04-19 18:47:42 -0500 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-06-10 10:41:49 +0200 |
commit | 8021c5a5311a322fec12b4b188ad96d8465ea94c (patch) | |
tree | 0872602aadabc279b998c10058807cfb1d60c9a5 /src/nvim/api/window.c | |
parent | 21645e603cbc7003898315d753a0f3f7c867f68a (diff) | |
download | rneovim-8021c5a5311a322fec12b4b188ad96d8465ea94c.tar.gz rneovim-8021c5a5311a322fec12b4b188ad96d8465ea94c.tar.bz2 rneovim-8021c5a5311a322fec12b4b188ad96d8465ea94c.zip |
api: include border in nvim_win_get_config
Diffstat (limited to 'src/nvim/api/window.c')
-rw-r--r-- | src/nvim/api/window.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index 178375d7f1..8514ac6b5f 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -6,20 +6,21 @@ #include <stdlib.h> #include <limits.h> -#include "nvim/ascii.h" -#include "nvim/globals.h" -#include "nvim/api/window.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/lua/executor.h" #include "nvim/ex_docmd.h" #include "nvim/vim.h" +#include "nvim/api/window.h" +#include "nvim/ascii.h" #include "nvim/buffer.h" #include "nvim/cursor.h" +#include "nvim/globals.h" +#include "nvim/move.h" #include "nvim/option.h" -#include "nvim/window.h" #include "nvim/screen.h" -#include "nvim/move.h" +#include "nvim/syntax.h" +#include "nvim/window.h" /// Gets the current buffer in a window /// @@ -456,6 +457,27 @@ Dictionary nvim_win_get_config(Window window, Error *err) PUT(rv, "row", FLOAT_OBJ(config->row)); PUT(rv, "col", FLOAT_OBJ(config->col)); } + if (config->border) { + Array border = ARRAY_DICT_INIT; + for (size_t i = 0; i < 8; i++) { + Array tuple = ARRAY_DICT_INIT; + + String s = cstrn_to_string((const char *)config->border_chars[i], sizeof(schar_T)); + + int hi_id = config->border_hl_ids[i]; + char_u *hi_name = syn_id2name(hi_id); + if (hi_name[0]) { + ADD(tuple, STRING_OBJ(s)); + ADD(tuple, STRING_OBJ(cstr_to_string((const char *)hi_name))); + ADD(border, ARRAY_OBJ(tuple)); + } else { + ADD(border, STRING_OBJ(s)); + } + } + PUT(rv, "border", ARRAY_OBJ(border)); + } else { + PUT(rv, "border", STRING_OBJ(cstr_to_string("none"))); + } } const char *rel = (wp->w_floating && !config->external |