mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
parent
e54c0ab367
commit
b94891421a
@ -250,11 +250,6 @@ static void tui_scheduler(Event event, void *d)
|
||||
loop_schedule(data->loop, event);
|
||||
}
|
||||
|
||||
static void refresh_event(void **argv)
|
||||
{
|
||||
ui_refresh();
|
||||
}
|
||||
|
||||
static void sigcont_cb(SignalWatcher *watcher, int signum, void *data)
|
||||
{
|
||||
((TUIData *)data)->cont_received = true;
|
||||
@ -265,8 +260,7 @@ static void sigwinch_cb(SignalWatcher *watcher, int signum, void *data)
|
||||
got_winch = true;
|
||||
UI *ui = data;
|
||||
update_size(ui);
|
||||
// run refresh_event in nvim main loop
|
||||
loop_schedule(&main_loop, event_create(1, refresh_event, 0));
|
||||
ui_schedule_refresh();
|
||||
}
|
||||
|
||||
static bool attrs_differ(HlAttrs a1, HlAttrs a2)
|
||||
|
@ -53,12 +53,10 @@ static bool pending_cursor_update = false;
|
||||
static int busy = 0;
|
||||
static int height, width;
|
||||
|
||||
// This set of macros allow us to use UI_CALL to invoke any function on
|
||||
// registered UI instances. The functions can have 0-5 arguments(configurable
|
||||
// by SELECT_NTH)
|
||||
// UI_CALL invokes a function on all registered UI instances. The functions can
|
||||
// have 0-5 arguments (configurable by SELECT_NTH).
|
||||
//
|
||||
// See http://stackoverflow.com/a/11172679 for a better explanation of how it
|
||||
// works.
|
||||
// See http://stackoverflow.com/a/11172679 for how it works.
|
||||
#ifdef _MSC_VER
|
||||
# define UI_CALL(funname, ...) \
|
||||
do { \
|
||||
@ -169,8 +167,8 @@ void ui_refresh(void)
|
||||
|
||||
for (size_t i = 0; i < ui_count; i++) {
|
||||
UI *ui = uis[i];
|
||||
width = ui->width < width ? ui->width : width;
|
||||
height = ui->height < height ? ui->height : height;
|
||||
width = MIN(ui->width, width);
|
||||
height = MIN(ui->height, height);
|
||||
pum_external &= ui->pum_external;
|
||||
}
|
||||
|
||||
@ -179,6 +177,16 @@ void ui_refresh(void)
|
||||
pum_set_external(pum_external);
|
||||
}
|
||||
|
||||
static void ui_refresh_handler(void **argv)
|
||||
{
|
||||
ui_refresh();
|
||||
}
|
||||
|
||||
void ui_schedule_refresh(void)
|
||||
{
|
||||
loop_schedule(&main_loop, event_create(1, ui_refresh_handler, 0));
|
||||
}
|
||||
|
||||
void ui_resize(int new_width, int new_height)
|
||||
{
|
||||
width = new_width;
|
||||
@ -252,7 +260,7 @@ void ui_detach_impl(UI *ui)
|
||||
}
|
||||
|
||||
if (--ui_count) {
|
||||
ui_refresh();
|
||||
ui_schedule_refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user