From 273c28df2aa5cc0d122b1a0f3c0014a56ab8c392 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Thu, 15 Jan 2009 15:56:11 +0100 Subject: [PATCH] Tree view: make drawing more smooth by using the dirty flag --- NEWS | 4 ++++ tig.c | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 4f41bd2..2ac62ca 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,10 @@ Release notes tig master ---------- +Improvements: + + - Tree view: avoid flickering when updating. + Bug fixes: - Tree view: fix memory corruption bug when updating. diff --git a/tig.c b/tig.c index 68d33ac..c141288 100644 --- a/tig.c +++ b/tig.c @@ -1021,6 +1021,7 @@ struct line { /* State flags */ unsigned int selected:1; unsigned int dirty:1; + unsigned int cleareol:1; void *data; /* User data */ }; @@ -1983,18 +1984,18 @@ draw_view_line(struct view *view, unsigned int lineno) line = &view->line[view->offset + lineno]; wmove(view->win, lineno, 0); + if (line->cleareol) + wclrtoeol(view->win); view->col = 0; view->curline = line; view->curtype = LINE_NONE; line->selected = FALSE; - line->dirty = 0; + line->dirty = line->cleareol = 0; if (selected) { set_view_attr(view, LINE_CURSOR); line->selected = TRUE; view->ops->select(view, line); - } else if (line->selected) { - wclrtoeol(view->win); } scrollok(view->win, FALSE); @@ -2681,7 +2682,7 @@ update_view(struct view *view) char *line; /* Clear the view and redraw everything since the tree sorting * might have rearranged things. */ - bool redraw = view == VIEW(REQ_VIEW_TREE); + bool redraw = FALSE; bool can_read = TRUE; if (!view->pipe) @@ -3633,6 +3634,8 @@ tree_read(struct view *view, char *text) line->data = text; line->type = type; + for (; line <= entry; line++) + line->dirty = line->cleareol = 1; return TRUE; } -- 2.30.2