Commit 3485ce24442160d83a37752046438761f254c477

Refactor revgraph drawing into draw_graphic()

Commit diff

tig.c

 
15531553}
15541554
15551555static int
1556draw_graphic(struct view *view, enum line_type type, chtype graphic[], size_t size, size_t max)
1557{
1558 int i;
1559 int col;
1560
1561 if (max < size)
1562 size = max;
1563
1564 set_view_attr(view, type);
1565 /* Using waddch() instead of waddnstr() ensures that
1566 * they'll be rendered correctly for the cursor line. */
1567 for (i = 0; i < size; i++)
1568 waddch(view->win, graphic[i]);
1569
1570 col = size;
1571 if (size < max) {
1572 waddch(view->win, ' ');
1573 col++;
1574 }
1575
1576 return col;
1577}
1578
1579static int
15561580draw_date(struct view *view, struct tm *time, int max)
15571581{
15581582 char buf[DATE_COLS];
48784878 col += AUTHOR_COLS;
48794879 if (col >= view->width)
48804880 return TRUE;
4881 wmove(view->win, lineno, col);
48814882 }
48824883
48834884 if (opt_rev_graph && commit->graph_size) {
4884 size_t graph_size = view->width - col;
4885 size_t i;
4886
4887 set_view_attr(view, LINE_MAIN_REVGRAPH);
4888 wmove(view->win, lineno, col);
4889 if (graph_size > commit->graph_size)
4890 graph_size = commit->graph_size;
4891 /* Using waddch() instead of waddnstr() ensures that
4892 * they'll be rendered correctly for the cursor line. */
4893 for (i = 0; i < graph_size; i++)
4894 waddch(view->win, commit->graph[i]);
4895
4896 col += commit->graph_size + 1;
4885 col += draw_graphic(view, LINE_MAIN_REVGRAPH,
4886 commit->graph, commit->graph_size,
4887 view->width - col);
48974888 if (col >= view->width)
48984889 return TRUE;
4899 waddch(view->win, ' ');
49004890 }
49014891
4902 set_view_attr(view, LINE_DEFAULT);
4903 wmove(view->win, lineno, col);
4904
49054892 if (opt_show_refs && commit->refs) {
49064893 size_t i = 0;
49074894
toggle raw diff