From 39e089cc057f141ed440635493a041dc321eb2c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 28 May 2016 13:13:55 +0100 Subject: vis: try to reduce number of redraws This is a not yet successful attempt to reduce terminal flickering when resizing windows as is for example the case when entering command mode. UI related debug output can be enabled with: $ make CFLAGS=-DDEBUG_UI=1 $ ./vis > log --- vis-prompt.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'vis-prompt.c') diff --git a/vis-prompt.c b/vis-prompt.c index 8f7e1a9..ffe3ea2 100644 --- a/vis-prompt.c +++ b/vis-prompt.c @@ -152,17 +152,16 @@ static const KeyBinding prompt_backspace_binding = { void vis_prompt_show(Vis *vis, const char *title) { Win *active = vis->win; - Win *prompt = window_new_file(vis, title[0] == ':' ? vis->command_file : vis->search_file); + Win *prompt = window_new_file(vis, title[0] == ':' ? vis->command_file : vis->search_file, + UI_OPTION_ONELINE); if (!prompt) return; if (vis->mode->visual) window_selection_save(active); - view_options_set(prompt->view, UI_OPTION_ONELINE); Text *txt = prompt->file->text; text_insert(txt, text_size(txt), title, strlen(title)); Cursor *cursor = view_cursors_primary_get(prompt->view); view_cursors_scroll_to(cursor, text_size(txt)); - view_draw(prompt->view); prompt->parent = active; prompt->parent_mode = vis->mode; vis_window_mode_map(prompt, VIS_MODE_NORMAL, true, "", &prompt_enter_binding); @@ -172,7 +171,6 @@ void vis_prompt_show(Vis *vis, const char *title) { vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "", &prompt_up_binding); vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "", &prompt_backspace_binding); vis_mode_switch(vis, VIS_MODE_INSERT); - vis_draw(vis); } void vis_info_show(Vis *vis, const char *msg, ...) { @@ -190,7 +188,7 @@ void vis_message_show(Vis *vis, const char *msg) { if (!msg) return; if (!vis->message_window) - vis->message_window = window_new_file(vis, vis->error_file); + vis->message_window = window_new_file(vis, vis->error_file, UI_OPTION_STATUSBAR); Win *win = vis->message_window; if (!win) return; -- cgit v1.2.3