summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9d2d872)
raw | patch | inline | side by side (parent: 9d2d872)
author | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 22 Apr 2008 11:18:48 +0000 (13:18 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 22 Apr 2008 11:33:38 +0000 (13:33 +0200) |
tig.c | patch | blob | history |
index 88e32201508edb5c1e9c592ba888ec871baa0306..d9bd9da7f8327627986a664fb8d6aeae8d0f8e8f 100644 (file)
--- a/tig.c
+++ b/tig.c
return col;
}
+static int
+draw_graphic(struct view *view, enum line_type type, chtype graphic[], size_t size, size_t max)
+{
+ int i;
+ int col;
+
+ if (max < size)
+ size = max;
+
+ set_view_attr(view, type);
+ /* Using waddch() instead of waddnstr() ensures that
+ * they'll be rendered correctly for the cursor line. */
+ for (i = 0; i < size; i++)
+ waddch(view->win, graphic[i]);
+
+ col = size;
+ if (size < max) {
+ waddch(view->win, ' ');
+ col++;
+ }
+
+ return col;
+}
+
static int
draw_date(struct view *view, struct tm *time, int max)
{
col += AUTHOR_COLS;
if (col >= view->width)
return TRUE;
+ wmove(view->win, lineno, col);
}
if (opt_rev_graph && commit->graph_size) {
- size_t graph_size = view->width - col;
- size_t i;
-
- set_view_attr(view, LINE_MAIN_REVGRAPH);
- wmove(view->win, lineno, col);
- if (graph_size > commit->graph_size)
- graph_size = commit->graph_size;
- /* Using waddch() instead of waddnstr() ensures that
- * they'll be rendered correctly for the cursor line. */
- for (i = 0; i < graph_size; i++)
- waddch(view->win, commit->graph[i]);
-
- col += commit->graph_size + 1;
+ col += draw_graphic(view, LINE_MAIN_REVGRAPH,
+ commit->graph, commit->graph_size,
+ view->width - col);
if (col >= view->width)
return TRUE;
- waddch(view->win, ' ');
}
- set_view_attr(view, LINE_DEFAULT);
- wmove(view->win, lineno, col);
-
if (opt_show_refs && commit->refs) {
size_t i = 0;