aboutsummaryrefslogtreecommitdiff
path: root/view.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 /view.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 'view.c')
-rw-r--r--view.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/view.c b/view.c
index 4b06d3a..33e73cd 100644
--- a/view.c
+++ b/view.c
@@ -513,6 +513,8 @@ bool view_resize(View *view, int width, int height) {
width = 1;
if (height <= 0)
height = 1;
+ if (view->width == width && view->height == height)
+ return true;
size_t lines_size = height*(sizeof(Line) + width*sizeof(Cell));
if (lines_size > view->lines_size) {
Line *lines = realloc(view->lines, lines_size);
@@ -525,6 +527,8 @@ bool view_resize(View *view, int width, int height) {
view->height = height;
memset(view->lines, 0, view->lines_size);
view_draw(view);
+ if (view->ui)
+ view_update(view);
return true;
}