From 199d1288c79737afd64ec60e4e1b1fa1dc7046c2 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Mon, 22 May 2006 01:04:49 +0200 Subject: [PATCH] End the current update before begining a new one; fixes CPU hogging --- tig.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/tig.c b/tig.c index bf53092..236c701 100644 --- a/tig.c +++ b/tig.c @@ -1075,11 +1075,27 @@ move_view(struct view *view, enum request request, bool redraw) * Incremental updating */ +static void +end_update(struct view *view) +{ + if (!view->pipe) + return; + set_nonblocking_input(FALSE); + if (view->pipe == stdin) + fclose(view->pipe); + else + pclose(view->pipe); + view->pipe = NULL; +} + static bool begin_update(struct view *view) { const char *id = view->id; + if (view->pipe) + end_update(view); + if (opt_cmd[0]) { string_copy(view->cmd, opt_cmd); opt_cmd[0] = 0; @@ -1128,19 +1144,6 @@ begin_update(struct view *view) return TRUE; } -static void -end_update(struct view *view) -{ - if (!view->pipe) - return; - set_nonblocking_input(FALSE); - if (view->pipe == stdin) - fclose(view->pipe); - else - pclose(view->pipe); - view->pipe = NULL; -} - static bool update_view(struct view *view) { -- 2.30.2