mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 06:48:17 +00:00
ui: refactor ui options
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
#define MAX_UI_COUNT 16
|
||||
|
||||
static UI *uis[MAX_UI_COUNT];
|
||||
static bool ui_ext[UI_WIDGETS] = { 0 };
|
||||
static bool ui_ext[kUIExtCount] = { 0 };
|
||||
static size_t ui_count = 0;
|
||||
static int row = 0, col = 0;
|
||||
static struct {
|
||||
@@ -246,8 +246,8 @@ void ui_refresh(void)
|
||||
}
|
||||
|
||||
int width = INT_MAX, height = INT_MAX;
|
||||
bool ext_widgets[UI_WIDGETS];
|
||||
for (UIWidget i = 0; (int)i < UI_WIDGETS; i++) {
|
||||
bool ext_widgets[kUIExtCount];
|
||||
for (UIExtension i = 0; (int)i < kUIExtCount; i++) {
|
||||
ext_widgets[i] = true;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ void ui_refresh(void)
|
||||
UI *ui = uis[i];
|
||||
width = MIN(ui->width, width);
|
||||
height = MIN(ui->height, height);
|
||||
for (UIWidget i = 0; (int)i < UI_WIDGETS; i++) {
|
||||
for (UIExtension i = 0; (int)i < kUIExtCount; i++) {
|
||||
ext_widgets[i] &= ui->ui_ext[i];
|
||||
}
|
||||
}
|
||||
@@ -267,8 +267,10 @@ void ui_refresh(void)
|
||||
screen_resize(width, height);
|
||||
p_lz = save_p_lz;
|
||||
|
||||
for (UIWidget i = 0; (int)i < UI_WIDGETS; i++) {
|
||||
ui_set_external(i, ext_widgets[i]);
|
||||
for (UIExtension i = 0; (int)i < kUIExtCount; i++) {
|
||||
ui_ext[i] = ext_widgets[i];
|
||||
ui_call_option_set(cstr_as_string((char *)ui_ext_names[i]),
|
||||
BOOLEAN_OBJ(ext_widgets[i]));
|
||||
}
|
||||
ui_mode_info_set();
|
||||
old_mode_idx = -1;
|
||||
@@ -527,15 +529,7 @@ void ui_cursor_shape(void)
|
||||
}
|
||||
|
||||
/// Returns true if `widget` is externalized.
|
||||
bool ui_is_external(UIWidget widget)
|
||||
bool ui_is_external(UIExtension widget)
|
||||
{
|
||||
return ui_ext[widget];
|
||||
}
|
||||
|
||||
/// Sets `widget` as "external".
|
||||
/// Such widgets are not drawn by Nvim; external UIs are expected to handle
|
||||
/// higher-level UI events and present the data.
|
||||
void ui_set_external(UIWidget widget, bool external)
|
||||
{
|
||||
ui_ext[widget] = external;
|
||||
}
|
||||
|
Reference in New Issue
Block a user