mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 01:38:16 +00:00
api: include border in nvim_win_get_config
This commit is contained in:

committed by
Björn Linse

parent
21645e603c
commit
8021c5a531
@@ -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/option.h"
|
||||
#include "nvim/window.h"
|
||||
#include "nvim/screen.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/move.h"
|
||||
#include "nvim/option.h"
|
||||
#include "nvim/screen.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
|
||||
|
Reference in New Issue
Block a user