From 9a6b04c31d524f9f203f3fd47e452bf464f3fc37 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Fri, 9 Jan 2009 13:02:02 -0500 Subject: [PATCH] Add setup_update for initialize incremental view updates Refactors common parts of begin_update and blame_open. --- tig.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tig.c b/tig.c index ba7af09..c80078b 100644 --- a/tig.c +++ b/tig.c @@ -2234,6 +2234,15 @@ end_update(struct view *view, bool force) view->pipe = NULL; } +static void +setup_update(struct view *view, const char *vid) +{ + set_nonblocking_input(TRUE); + reset_view(view); + string_copy_rev(view->vid, vid); + view->start_time = time(NULL); +} + static bool begin_update(struct view *view, bool refresh) { @@ -2285,11 +2294,7 @@ begin_update(struct view *view, bool refresh) if (!view->pipe) return FALSE; - set_nonblocking_input(TRUE); - reset_view(view); - string_copy_rev(view->vid, view->id); - - view->start_time = time(NULL); + setup_update(view, view->id); return TRUE; } @@ -3536,11 +3541,8 @@ blame_open(struct view *view) return FALSE; } - reset_view(view); + setup_update(view, opt_file); string_format(view->ref, "%s ...", opt_file); - string_copy_rev(view->vid, opt_file); - set_nonblocking_input(TRUE); - view->start_time = time(NULL); return TRUE; } -- 2.30.2