summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a271d45)
raw | patch | inline | side by side (parent: a271d45)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 19 Nov 2008 11:24:22 +0000 (12:24 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 13 Jan 2009 21:55:20 +0000 (22:55 +0100) |
Inspired by Karl Chen.
tig.c | patch | blob | history |
index 544fd8544331ddf143c2659e9f747d89171c5da9..30983081aba74847eaa8e346897eb7073c0a2b28 100644 (file)
--- a/tig.c
+++ b/tig.c
struct io io;
struct io *pipe;
time_t start_time;
+ time_t update_secs;
};
struct view_ops {
assert(view_is_displayed(view));
- if (view != VIEW(REQ_VIEW_STATUS) && (view->lines || view->pipe)) {
+ if (view != VIEW(REQ_VIEW_STATUS) && view->lines) {
unsigned int view_lines = view->offset + view->height;
unsigned int lines = view->lines
? MIN(view_lines, view->lines) * 100 / view->lines
: 0;
- string_format_from(state, &statelen, "- %s %d of %d (%d%%)",
+ string_format_from(state, &statelen, " - %s %d of %d (%d%%)",
view->ops->type,
view->lineno + 1,
view->lines,
lines);
- if (view->pipe) {
- time_t secs = time(NULL) - view->start_time;
+ }
- /* Three git seconds are a long time ... */
- if (secs > 2)
- string_format_from(state, &statelen, " %lds", secs);
- }
+ if (view->pipe) {
+ time_t secs = time(NULL) - view->start_time;
+
+ /* Three git seconds are a long time ... */
+ if (secs > 2)
+ string_format_from(state, &statelen, " loading %lds", secs);
}
string_format_from(buf, &bufpos, "[%s]", view->name);
}
if (statelen && bufpos < view->width) {
- string_format_from(buf, &bufpos, " %s", state);
+ string_format_from(buf, &bufpos, "%s", state);
}
if (view == display[current_view])
view->line_size = 0;
view->line_alloc = 0;
view->vid[0] = 0;
+ view->update_secs = 0;
}
static void
if (!view->pipe)
return TRUE;
- if (!io_can_read(view->pipe))
+ if (!io_can_read(view->pipe)) {
+ if (view->lines == 0) {
+ time_t secs = time(NULL) - view->start_time;
+
+ if (secs > view->update_secs) {
+ if (view->update_secs == 0)
+ redraw_view(view);
+ update_view_title(view);
+ view->update_secs = secs;
+ }
+ }
return TRUE;
+ }
/* Only redraw if lines are visible. */
if (view->offset + view->height >= view->lines)