aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-05-28 13:13:55 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-05-28 14:16:46 +0200
commit39e089cc057f141ed440635493a041dc321eb2c3 (patch)
treec0002f9fc0a5eb9ddc07b334a7a8a66f9d293614 /vis.c
parenta834016170048cf746dcbbbe5755d4ca989c03c0 (diff)
downloadvis-39e089cc057f141ed440635493a041dc321eb2c3.tar.gz
vis-39e089cc057f141ed440635493a041dc321eb2c3.tar.xz
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
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/vis.c b/vis.c
index 3b5e0d0..cdc3057 100644
--- a/vis.c
+++ b/vis.c
@@ -217,7 +217,7 @@ static void window_draw(void *ctx) {
}
}
-Win *window_new_file(Vis *vis, File *file) {
+Win *window_new_file(Vis *vis, File *file, enum UiOption options) {
Win *win = calloc(1, sizeof(Win));
if (!win)
return NULL;
@@ -228,7 +228,7 @@ Win *window_new_file(Vis *vis, File *file) {
win->event.draw = window_draw;
win->horizon = 1 << 15;
win->view = view_new(file->text, &win->event);
- win->ui = vis->ui->window_new(vis->ui, win->view, file, UI_OPTION_STATUSBAR);
+ win->ui = vis->ui->window_new(vis->ui, win->view, file, options);
if (!win->jumplist || !win->view || !win->ui) {
window_free(win);
return NULL;
@@ -267,7 +267,7 @@ bool vis_window_reload(Win *win) {
}
bool vis_window_split(Win *original) {
- Win *win = window_new_file(original->vis, original->file);
+ Win *win = window_new_file(original->vis, original->file, UI_OPTION_STATUSBAR);
if (!win)
return false;
for (size_t i = 0; i < LENGTH(win->modes); i++) {
@@ -281,7 +281,6 @@ bool vis_window_split(Win *original) {
vis_window_syntax_set(win, vis_window_syntax_get(original));
view_options_set(win->view, view_options_get(original->view));
view_cursor_to(win->view, view_cursor_get(original->view));
- vis_draw(win->vis);
return true;
}
@@ -344,7 +343,6 @@ void vis_redraw(Vis *vis) {
void vis_update(Vis *vis) {
for (Win *win = vis->windows; win; win = win->next)
view_update(win->view);
- view_update(vis->win->view);
vis->ui->update(vis->ui);
}
@@ -356,14 +354,12 @@ bool vis_window_new(Vis *vis, const char *filename) {
File *file = file_new(vis, filename);
if (!file)
return false;
- Win *win = window_new_file(vis, file);
+ Win *win = window_new_file(vis, file, UI_OPTION_STATUSBAR);
if (!win) {
file_free(vis, file);
return false;
}
- vis_draw(vis);
-
return true;
}