refactor(redraw): various simplifications

This commit is contained in:
bfredl
2022-09-27 15:24:09 +02:00
parent 6679687bb3
commit cce0840cbf
5 changed files with 79 additions and 106 deletions

View File

@@ -314,7 +314,7 @@ int main(int argc, char **argv)
assert(p_ch >= 0 && Rows >= p_ch && Rows - p_ch <= INT_MAX);
cmdline_row = (int)(Rows - p_ch);
msg_row = cmdline_row;
screenalloc(); // allocate screen buffers
default_grid_alloc(); // allocate screen buffers
set_init_2(headless_mode);
TIME_MSG("inits 2");
@@ -346,13 +346,14 @@ int main(int argc, char **argv)
ui_builtin_start();
}
TIME_MSG("done waiting for UI");
// prepare screen now, so external UIs can display messages
starting = NO_BUFFERS;
screenclear();
TIME_MSG("init screen for UI");
}
// prepare screen now
starting = NO_BUFFERS;
screenclear();
win_new_screensize();
TIME_MSG("clear screen");
if (ui_client_channel_id) {
ui_client_init(ui_client_channel_id);
ui_client_execute(ui_client_channel_id);
@@ -361,8 +362,8 @@ int main(int argc, char **argv)
// Default mappings (incl. menus)
Error err = ERROR_INIT;
Object o = nlua_exec(STATIC_CSTR_AS_STRING("return vim._init_default_mappings()"),
(Array)ARRAY_DICT_INIT, &err);
Object o = NLUA_EXEC_STATIC("return vim._init_default_mappings()",
(Array)ARRAY_DICT_INIT, &err);
assert(!ERROR_SET(&err));
api_clear_error(&err);
assert(o.type == kObjectTypeNil);
@@ -432,10 +433,8 @@ int main(int argc, char **argv)
p_ut = 1;
}
//
// Read in registers, history etc, from the ShaDa file.
// This is where v:oldfiles gets filled.
//
if (*p_shada != NUL) {
shada_read_everything(NULL, false, true);
TIME_MSG("reading ShaDa");
@@ -474,14 +473,7 @@ int main(int argc, char **argv)
setmouse(); // may start using the mouse
if (exmode_active || use_remote_ui || use_builtin_ui) {
// Don't clear the screen when starting in Ex mode, or when a UI might have
// displayed messages.
redraw_later(curwin, UPD_VALID);
} else {
screenclear(); // clear screen
TIME_MSG("clearing screen");
}
redraw_later(curwin, UPD_VALID);
no_wait_return = true;