From: Jonas Fonseca Date: Sun, 21 May 2006 23:04:49 +0000 (+0200) Subject: End the current update before begining a new one; fixes CPU hogging X-Git-Tag: tig-0.4~66 X-Git-Url: https://git.distorted.org.uk/~mdw/tig/commitdiff_plain/199d1288c79737afd64ec60e4e1b1fa1dc7046c2 End the current update before begining a new one; fixes CPU hogging --- 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) {