Commit d7cb2133b0e3fd4031f84754f98cd5b833e55f65

Merge branch 'master' into release

Commit diff

Makefile

 
3737DFLAGS = -g -DDEBUG -Werror
3838PROGS = tig
3939MANDOC = tig.1 tigrc.5
40HTMLDOC = tig.1.html tigrc.5.html manual.html README.html
40HTMLDOC = tig.1.html tigrc.5.html manual.html README.html NEWS.html
4141ALLDOC = $(MANDOC) $(HTMLDOC) manual.html-chunked manual.pdf
4242
4343# Never include the release number in the tarname for tagged
162162README.html: README asciidoc.conf
163163 $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d article -a readme $<
164164
165NEWS.html: NEWS asciidoc.conf
166 $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d article $<
167
165168%.1.html : %.1.txt asciidoc.conf
166169 $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d manpage $<
167170
toggle raw diff

NEWS

 
1Release notes
2=============
3
4tig master branch
5-----------------
6
7Improvements:
8
9 - F5 also refreshes the current view.
10 - Allow line graphics to be disabled with new line-graphics option.
11 - Also include the reference names when searching.
12
13Bug fixes:
14
15 - Fix regression when staging all diff chunks in a section.
16 - Bind the maximize view action to 'O'; it conflicted with the
17 keybinding to launch the merge tool in the status view.
18
19tig-0.11
20--------
21
22Incompatibilities:
23
24 - Remove parsing of deprecated options: -g, -l, -d.
25 - The first seen '--' will stop option parsing and is passed to git
26 instead of breaking out of tig's option parsing.
27
28New features:
29
30 - Blame view; bound to 'B' by default, reachable from the command line
31 and the tree, status, and stage views.
32 - Blame/main view: allow display of date, author, and references to be
33 toggled on/off. Bound to 'D', 'A', and 'F' respectively.
34 - Add action to maximize the current view.
35
36Improvements:
37
38 - Show the current branch in the status view.
39 - Show local/light-weight tags.
40
41Bug fixes:
42
43 - Fix regressions for the pager mode.
44 - Fix refreshing of the index with working directory info.
45
46tig-0.10.1
47----------
48
49Improvements:
50
51 - Status view: detect renamed files and show them with 'R'.
52 - Status view: refresh the index to avoid "empty diffs".
53 - Diff view: make diff headers more verbose to include e.g. committer.
54 - Configure: check for the ncursesw library.
55
56Bug fixes:
57
58 - Fix UTF8 handling for tag names and commit messages.
59 - Fix the check for git-config(1) in configure to handle the case when
60 git has been installed using a libexecdir which is not in the path.
61 - Fix replacing of SYSCONFDIR when installing from released tarballs.
62
63tig-0.10
64---------
65
66Incompatibilities:
67
68 - Deprecate most tig specific command line options to make tig more
69 compatible with gitk. The deprecated options are: -g, -l, -d, and -S.
70 Use of any of them will result in a warning being printed to stderr.
71 Instead of '-S', use the new 'status' subcommand.
72 - Make man page building depend on DocBook XSL version >= 1.72.0.
73 - Install man pages in $(prefix)/share/man.
74 - Implement the cherry pick action (bound to 'C') using new support for
75 running external commands. This obsoletes the TIG_CHEERY_PICK
76 environment variable
77
78New features:
79
80 - Add support for binding keys to external commands. To bind '.' to
81 running git-commit(1), add the line: "bind generic . !git commit" to
82 your ~/.tigrc. Each command can have replacement string such as
83 %(commit), %(head), and %(blob), which are substituted before the
84 command is run.
85 - Add system-wide configuration file defaulting to $(prefix)/etc/tigrc.
86 - Add the environment variables TIGRC_USER and TIGRC_SYSTEM to change
87 user and system-wide configuration files, respectively.
88
89Improvements:
90
91 - Main view: color the revision graph.
92 - Main view: show boundary commits; they are marked with '^' in the
93 revision graph.
94 - Tree view: add tree-parent action to jump to view of the parent tree.
95 Bound to ',' by default.
96 - Allow the default terminal colors to be overwritten. To use black
97 text on white, add the line "color default white black" to your
98 ~/.tigrc.
99 - Misc. documentation improvements.
100
101Bug fixes:
102
103 - Use git-diff-index(1) and git-diff-files(1) instead of git-diff(1) to
104 avoid running external diff drivers.
105 - Use --no-color when calling git-log(1).
106 - Fix crash when opening mergetool for lines that are not unmerged.
107
108tig-0.9.1
109---------
110
111Incompatibilities:
112
113 - Make the clean rule to never remove generated documentation files.
114 Use the distclean rule for accomplishing this.
115
116New features:
117
118 - Add support for cherry-picking commits in the main view to the
119 current branch. Bound to 'C' by default.
120
121Improvements:
122
123 - Add support for launching git-mergetool(1) from the status view.
124 Bound to 'M' by default.
125 - Add support for refreshing/reloading the status view
126 - Detect working trees and disable the status view when it is missing.
127
128Bug fixes:
129
130 - Fix iconv() checking in configure.
131 - Fix editor invocation to make paths relative to the project root.
132 - Fix out-of-range current line when reloading the status view.
133 - Include autoconf files in the tarball generated by `make dist`.
134
135tig-0.9
136-------
137
138New features:
139
140 - Add bash completion script for tig (contrib/tig-completion.bash).
141 - Add optional autoconf-based build infrastructure.
142 - Add stage view for showing changes in the working tree and add
143 support for staging individual diff chunks for commit.
144
145Improvements:
146
147 - Status view: allow all files in a section to be staged for commit.
148 - Status view: Add support for opening files in an editor. Bound to 'e'
149 by default.
150 - Tree view: use a stack for remembering the lines for parent tree.
toggle raw diff

asciidoc.conf

 
5656
5757[footer]
5858</div>
59
60[replacements]
61(^|[^-\\])--($|[^-])=\1--\2
5962endif::readme[]
toggle raw diff

tig.c

<
 
5858static void report(const char *msg, ...);
5959static int read_properties(FILE *pipe, const char *separators, int (*read)(char *, size_t, char *, size_t));
6060static void set_nonblocking_input(bool loading);
61static size_t utf8_length(const char *string, size_t max_width, int *trimmed, bool reserve);
61static size_t utf8_length(const char *string, int *width, size_t max_width, int *trimmed, bool reserve);
6262
6363#define ABS(x) ((x) >= 0 ? (x) : -(x))
6464#define MIN(x, y) ((x) < (y) ? (x) : (y))
7777#define REVGRAPH_BRANCH '+'
7878#define REVGRAPH_COMMIT '*'
7979#define REVGRAPH_BOUND '^'
80#define REVGRAPH_LINE '|'
8180
8281#define SIZEOF_REVGRAPH 19 /* Size of revision ancestry graphics. */
8382
9898/* The default interval between line numbers. */
9999#define NUMBER_INTERVAL 5
100100
101#define TABSIZE 8
101#define TAB_SIZE 8
102102
103103#define SCALE_SPLIT_VIEW(height) ((height) * 2 / 3)
104104
437437static bool opt_date = TRUE;
438438static bool opt_author = TRUE;
439439static bool opt_line_number = FALSE;
440static bool opt_line_graphics = TRUE;
440441static bool opt_rev_graph = FALSE;
441442static bool opt_show_refs = TRUE;
442443static int opt_num_interval = NUMBER_INTERVAL;
443static int opt_tab_size = TABSIZE;
444static int opt_tab_size = TAB_SIZE;
444445static enum request opt_request = REQ_VIEW_MAIN;
445446static char opt_cmd[SIZEOF_STR] = "";
446447static char opt_path[SIZEOF_STR] = "";
612612enum line_type {
613613#define LINE(type, line, fg, bg, attr) \
614614 LINE_##type
615 LINE_INFO
615 LINE_INFO,
616 LINE_NONE
616617#undef LINE
617618};
618619
732732 { KEY_UP, REQ_PREVIOUS },
733733 { KEY_DOWN, REQ_NEXT },
734734 { 'R', REQ_REFRESH },
735 { 'M', REQ_MAXIMIZE },
735 { KEY_F(5), REQ_REFRESH },
736 { 'O', REQ_MAXIMIZE },
736737
737738 /* Cursor navigation */
738739 { 'k', REQ_MOVE_UP },
956956static enum request
957957add_run_request(enum keymap keymap, int key, int argc, char **argv)
958958{
959 struct run_request *tmp;
960 struct run_request req = { keymap, key };
959 struct run_request *req;
960 char cmd[SIZEOF_STR];
961961 size_t bufpos;
962962
963963 for (bufpos = 0; argc > 0; argc--, argv++)
964 if (!string_format_from(req.cmd, &bufpos, "%s ", *argv))
964 if (!string_format_from(cmd, &bufpos, "%s ", *argv))
965965 return REQ_NONE;
966966
967 req.cmd[bufpos - 1] = 0;
968
969 tmp = realloc(run_request, (run_requests + 1) * sizeof(*run_request));
970 if (!tmp)
967 req = realloc(run_request, (run_requests + 1) * sizeof(*run_request));
968 if (!req)
971969 return REQ_NONE;
972970
973 run_request = tmp;
974 run_request[run_requests++] = req;
971 run_request = req;
972 req = &run_request[run_requests++];
973 string_copy(req->cmd, cmd);
974 req->keymap = keymap;
975 req->key = key;
975976
976977 return REQ_NONE + run_requests;
977978}
11291129 return OK;
11301130 }
11311131
1132 if (!strcmp(argv[0], "line-graphics")) {
1133 opt_line_graphics = parse_bool(argv[2]);
1134 return OK;
1135 }
1136
11321137 if (!strcmp(argv[0], "line-number-interval")) {
11331138 opt_num_interval = atoi(argv[2]);
11341139 return OK;
13991399 size_t line_size; /* Total number of used lines */
14001400 unsigned int digits; /* Number of digits in the lines member. */
14011401
1402 /* Drawing */
1403 struct line *curline; /* Line currently being drawn. */
1404 enum line_type curtype; /* Attribute currently used for drawing. */
1405 unsigned long col; /* Column when drawing. */
1406
14021407 /* Loading */
14031408 FILE *pipe;
14041409 time_t start_time;
14171417 /* Read one line; updates view->line. */
14181418 bool (*read)(struct view *view, char *data);
14191419 /* Draw one line; @lineno must be < view->height. */
1420 bool (*draw)(struct view *view, struct line *line, unsigned int lineno, bool selected);
1420 bool (*draw)(struct view *view, struct line *line, unsigned int lineno);
14211421 /* Depending on view handle a special requests. */
14221422 enum request (*request)(struct view *view, enum request request, struct line *line);
14231423 /* Search for regex in a line. */
14641464#define view_is_displayed(view) \
14651465 (view == display[0] || view == display[1])
14661466
1467
1468enum line_graphic {
1469 LINE_GRAPHIC_VLINE
1470};
1471
1472static int line_graphics[] = {
1473 /* LINE_GRAPHIC_VLINE: */ '|'
1474};
1475
1476static inline void
1477set_view_attr(struct view *view, enum line_type type)
1478{
1479 if (!view->curline->selected && view->curtype != type) {
1480 wattrset(view->win, get_line_attr(type));
1481 wchgat(view->win, -1, 0, type, NULL);
1482 view->curtype = type;
1483 }
1484}
1485
14671486static int
1468draw_text(struct view *view, const char *string, int max_len,
1469 bool use_tilde, bool selected)
1487draw_chars(struct view *view, enum line_type type, const char *string,
1488 int max_len, bool use_tilde)
14701489{
14711490 int len = 0;
1491 int col = 0;
14721492 int trimmed = FALSE;
14731493
14741494 if (max_len <= 0)
14751495 return 0;
14761496
14771497 if (opt_utf8) {
1478 len = utf8_length(string, max_len, &trimmed, use_tilde);
1498 len = utf8_length(string, &col, max_len, &trimmed, use_tilde);
14791499 } else {
1480 len = strlen(string);
1500 col = len = strlen(string);
14811501 if (len > max_len) {
14821502 if (use_tilde) {
14831503 max_len -= 1;
14841504 }
1485 len = max_len;
1505 col = len = max_len;
14861506 trimmed = TRUE;
14871507 }
14881508 }
14891509
1510 set_view_attr(view, type);
14901511 waddnstr(view->win, string, len);
14911512 if (trimmed && use_tilde) {
1492 if (!selected)
1493 wattrset(view->win, get_line_attr(LINE_DELIMITER));
1513 set_view_attr(view, LINE_DELIMITER);
14941514 waddch(view->win, '~');
1495 len++;
1515 col++;
14961516 }
14971517
1498 return len;
1518 return col;
14991519}
15001520
15011521static int
1502draw_lineno(struct view *view, unsigned int lineno, int max, bool selected)
1522draw_space(struct view *view, enum line_type type, int max, int spaces)
15031523{
1504 static char fmt[] = "%1ld";
1505 char number[10] = " ";
1524 static char space[] = " ";
1525 int col = 0;
1526
1527 spaces = MIN(max, spaces);
1528
1529 while (spaces > 0) {
1530 int len = MIN(spaces, sizeof(space) - 1);
1531
1532 col += draw_chars(view, type, space, spaces, FALSE);
1533 spaces -= len;
1534 }
1535
1536 return col;
1537}
1538
1539static bool
1540draw_lineno(struct view *view, unsigned int lineno)
1541{
1542 char number[10];
15061543 int digits3 = view->digits < 3 ? 3 : view->digits;
15071544 int max_number = MIN(digits3, STRING_SIZE(number));
1508 bool showtrimmed = FALSE;
1545 int max = view->width - view->col;
15091546 int col;
15101547
1548 if (max < max_number)
1549 max_number = max;
1550
15111551 lineno += view->offset + 1;
15121552 if (lineno == 1 || (lineno % opt_num_interval) == 0) {
1553 static char fmt[] = "%1ld";
1554
15131555 if (view->digits <= 9)
15141556 fmt[1] = '0' + digits3;
15151557
15161558 if (!string_format(number, fmt, lineno))
15171559 number[0] = 0;
1518 showtrimmed = TRUE;
1560 col = draw_chars(view, LINE_LINE_NUMBER, number, max_number, TRUE);
1561 } else {
1562 col = draw_space(view, LINE_LINE_NUMBER, max_number, max_number);
15191563 }
15201564
1521 if (max < max_number)
1522 max_number = max;
1523
1524 if (!selected)
1525 wattrset(view->win, get_line_attr(LINE_LINE_NUMBER));
1526 col = draw_text(view, number, max_number, showtrimmed, selected);
15271565 if (col < max) {
1528 if (!selected)
1529 wattrset(view->win, A_NORMAL);
1530 waddch(view->win, ACS_VLINE);
1566 set_view_attr(view, LINE_DEFAULT);
1567 waddch(view->win, line_graphics[LINE_GRAPHIC_VLINE]);
15311568 col++;
15321569 }
1533 if (col < max) {
1570
1571 if (col < max)
1572 col += draw_space(view, LINE_DEFAULT, max - col, 1);
1573 view->col += col;
1574
1575 return view->width - view->col <= 0;
1576}
1577
1578static bool
1579draw_text(struct view *view, enum line_type type, const char *string, bool trim)
1580{
1581 view->col += draw_chars(view, type, string, view->width - view->col, trim);
1582 return view->width - view->col <= 0;
1583}
1584
1585static bool
1586draw_graphic(struct view *view, enum line_type type, chtype graphic[], size_t size)
1587{
1588 int max = view->width - view->col;
1589 int i;
1590
1591 if (max < size)
1592 size = max;
1593
1594 set_view_attr(view, type);
1595 /* Using waddch() instead of waddnstr() ensures that
1596 * they'll be rendered correctly for the cursor line. */
1597 for (i = 0; i < size; i++)
1598 waddch(view->win, graphic[i]);
1599
1600 view->col += size;
1601 if (size < max) {
15341602 waddch(view->win, ' ');
1535 col++;
1603 view->col++;
15361604 }
15371605
1538 return col;
1606 return view->width - view->col <= 0;
15391607}
15401608
1541static int
1542draw_date(struct view *view, struct tm *time, int max, bool selected)
1609static bool
1610draw_field(struct view *view, enum line_type type, char *text, int len, bool trim)
15431611{
1544 char buf[DATE_COLS];
1612 int max = MIN(view->width - view->col, len);
15451613 int col;
1614
1615 if (text)
1616 col = draw_chars(view, type, text, max - 1, trim);
1617 else
1618 col = draw_space(view, type, max - 1, max - 1);
1619
1620 view->col += col + draw_space(view, LINE_DEFAULT, max - col, max - col);
1621 return view->width - view->col <= 0;
1622}
1623
1624static bool
1625draw_date(struct view *view, struct tm *time)
1626{
1627 char buf[DATE_COLS];
1628 char *date;
15461629 int timelen = 0;
15471630
1548 if (max > DATE_COLS)
1549 max = DATE_COLS;
15501631 if (time)
15511632 timelen = strftime(buf, sizeof(buf), DATE_FORMAT, time);
1552 if (!timelen) {
1553 memset(buf, ' ', sizeof(buf) - 1);
1554 buf[sizeof(buf) - 1] = 0;
1555 }
1556
1557 if (!selected)
1558 wattrset(view->win, get_line_attr(LINE_DATE));
1559 col = draw_text(view, buf, max, FALSE, selected);
1560 if (col < max) {
1561 if (!selected)
1562 wattrset(view->win, get_line_attr(LINE_DEFAULT));
1563 waddch(view->win, ' ');
1564 col++;
1565 }
1633 date = timelen ? buf : NULL;
15661634
1567 return col;
1635 return draw_field(view, LINE_DATE, date, DATE_COLS, FALSE);
15681636}
15691637
15701638static bool
16501650 line = &view->line[view->offset + lineno];
16511651
16521652 wmove(view->win, lineno, 0);
1653 view->col = 0;
1654 view->curline = line;
1655 view->curtype = LINE_NONE;
1656 line->selected = FALSE;
16531657
16541658 if (selected) {
1659 set_view_attr(view, LINE_CURSOR);
16551660 line->selected = TRUE;
16561661 view->ops->select(view, line);
1657 wchgat(view->win, -1, 0, LINE_CURSOR, NULL);
1658 wattrset(view->win, get_line_attr(LINE_CURSOR));
16591662 } else if (line->selected) {
1660 line->selected = FALSE;
16611663 wclrtoeol(view->win);
16621664 }
16631665
16641666 scrollok(view->win, FALSE);
1665 draw_ok = view->ops->draw(view, line, lineno, selected);
1667 draw_ok = view->ops->draw(view, line, lineno);
16661668 scrollok(view->win, TRUE);
16671669
16681670 return draw_ok;
24232423 OPEN_SPLIT = 1, /* Split current view. */
24242424 OPEN_BACKGROUNDED = 2, /* Backgrounded. */
24252425 OPEN_RELOAD = 4, /* Reload view even if it is the current. */
2426 OPEN_NOMAXIMIZE = 8, /* Do not maximize the current view. */
2426 OPEN_NOMAXIMIZE = 8 /* Do not maximize the current view. */
24272427};
24282428
24292429static void
28632863 */
28642864
28652865static bool
2866pager_draw(struct view *view, struct line *line, unsigned int lineno, bool selected)
2866pager_draw(struct view *view, struct line *line, unsigned int lineno)
28672867{
2868 static char spaces[] = " ";
28692868 char *text = line->data;
2870 int col = 0;
2871
2872 if (opt_line_number) {
2873 col += draw_lineno(view, lineno, view->width, selected);
2874 if (col >= view->width)
2875 return TRUE;
2876 }
2877
2878 if (!selected)
2879 wattrset(view->win, get_line_attr(line->type));
2880
2881 if (opt_tab_size < TABSIZE) {
2882 int col_offset = col;
2883
2884 col = 0;
2885 while (text && col_offset + col < view->width) {
2886 int cols_max = view->width - col_offset - col;
2887 char *pos = text;
2888 int cols;
2889
2890 if (*text == '\t') {
2891 text++;
2892 assert(sizeof(spaces) > TABSIZE);
2893 pos = spaces;
2894 cols = opt_tab_size - (col % opt_tab_size);
2895
2896 } else {
2897 text = strchr(text, '\t');
2898 cols = line ? text - pos : strlen(pos);
2899 }
2900
2901 waddnstr(view->win, pos, MIN(cols, cols_max));
2902 col += cols;
2903 }
29042869
2905 } else {
2906 draw_text(view, text, view->width - col, TRUE, selected);
2907 }
2870 if (opt_line_number && draw_lineno(view, lineno))
2871 return TRUE;
29082872
2873 draw_text(view, line->type, text, TRUE);
29092874 return TRUE;
29102875}
29112876
36543654}
36553655
36563656static bool
3657blame_draw(struct view *view, struct line *line, unsigned int lineno, bool selected)
3657blame_draw(struct view *view, struct line *line, unsigned int lineno)
36583658{
36593659 struct blame *blame = line->data;
3660 int col = 0;
3661
3662 if (opt_date) {
3663 struct tm *time = blame->commit && *blame->commit->filename
3664 ? &blame->commit->time : NULL;
3660 struct tm *time = NULL;
3661 char *id = NULL, *author = NULL;
36653662
3666 col += draw_date(view, time, view->width, selected);
3667 if (col >= view->width)
3668 return TRUE;
3663 if (blame->commit && *blame->commit->filename) {
3664 id = blame->commit->id;
3665 author = blame->commit->author;
3666 time = &blame->commit->time;
36693667 }
36703668
3671 if (opt_author) {
3672 int max = MIN(AUTHOR_COLS - 1, view->width - col);
3669 if (opt_date && draw_date(view, time))
3670 return TRUE;
36733671
3674 if (!selected)
3675 wattrset(view->win, get_line_attr(LINE_MAIN_AUTHOR));
3676 if (blame->commit)
3677 draw_text(view, blame->commit->author, max, TRUE, selected);
3678 col += AUTHOR_COLS;
3679 if (col >= view->width)
3680 return TRUE;
3681 wmove(view->win, lineno, col);
3682 }
3672 if (opt_author &&
3673 draw_field(view, LINE_MAIN_AUTHOR, author, AUTHOR_COLS, TRUE))
3674 return TRUE;
36833675
3684 {
3685 int max = MIN(ID_COLS - 1, view->width - col);
3686
3687 if (!selected)
3688 wattrset(view->win, get_line_attr(LINE_BLAME_ID));
3689 if (blame->commit)
3690 draw_text(view, blame->commit->id, max, FALSE, -1);
3691 col += ID_COLS;
3692 if (col >= view->width)
3693 return TRUE;
3694 wmove(view->win, lineno, col);
3695 }
3676 if (draw_field(view, LINE_BLAME_ID, id, ID_COLS, FALSE))
3677 return TRUE;
36963678
3697 col += draw_lineno(view, lineno, view->width - col, selected);
3698 if (col >= view->width)
3679 if (draw_lineno(view, lineno))
36993680 return TRUE;
37003681
3701 col += draw_text(view, blame->text, view->width - col, TRUE, selected);
3682 draw_text(view, LINE_DEFAULT, blame->text, TRUE);
37023683 return TRUE;
37033684}
37043685
37213721 struct blame_commit *commit = blame->commit;
37223722 regmatch_t pmatch;
37233723
3724#define MATCH(text) \
3725 (*text && regexec(view->regex, text, 1, &pmatch, 0) != REG_NOMATCH)
3724#define MATCH(text, on) \
3725 (on && *text && regexec(view->regex, text, 1, &pmatch, 0) != REG_NOMATCH)
37263726
37273727 if (commit) {
37283728 char buf[DATE_COLS + 1];
37293729
3730 if (MATCH(commit->title) ||
3731 MATCH(commit->author) ||
3732 MATCH(commit->id))
3730 if (MATCH(commit->title, 1) ||
3731 MATCH(commit->author, opt_author) ||
3732 MATCH(commit->id, opt_date))
37333733 return TRUE;
37343734
37353735 if (strftime(buf, sizeof(buf), DATE_FORMAT, &commit->time) &&
3736 MATCH(buf))
3736 MATCH(buf, 1))
37373737 return TRUE;
37383738 }
37393739
3740 return MATCH(blame->text);
3740 return MATCH(blame->text, 1);
37413741
37423742#undef MATCH
37433743}
40064006 return FALSE;
40074007 }
40084008
4009 system("git update-index -q --refresh 2>/dev/null");
4009 system("git update-index -q --refresh >/dev/null 2>/dev/null");
40104010
40114011 if (!status_run(view, indexcmd, indexstatus, LINE_STAT_STAGED) ||
40124012 !status_run(view, STATUS_DIFF_FILES_CMD, 0, LINE_STAT_UNSTAGED) ||
40384038}
40394039
40404040static bool
4041status_draw(struct view *view, struct line *line, unsigned int lineno, bool selected)
4041status_draw(struct view *view, struct line *line, unsigned int lineno)
40424042{
40434043 struct status *status = line->data;
4044 enum line_type type;
40444045 char *text;
4045 int col = 0;
4046
4047 if (selected) {
4048 /* No attributes. */
4049
4050 } else if (line->type == LINE_STAT_HEAD) {
4051 wattrset(view->win, get_line_attr(LINE_STAT_HEAD));
4052 wchgat(view->win, -1, 0, LINE_STAT_HEAD, NULL);
4053
4054 } else if (!status && line->type != LINE_STAT_NONE) {
4055 wattrset(view->win, get_line_attr(LINE_STAT_SECTION));
4056 wchgat(view->win, -1, 0, LINE_STAT_SECTION, NULL);
4057
4058 } else {
4059 wattrset(view->win, get_line_attr(line->type));
4060 }
40614046
40624047 if (!status) {
40634048 switch (line->type) {
40644049 case LINE_STAT_STAGED:
4050 type = LINE_STAT_SECTION;
40654051 text = "Changes to be committed:";
40664052 break;
40674053
40684054 case LINE_STAT_UNSTAGED:
4055 type = LINE_STAT_SECTION;
40694056 text = "Changed but not updated:";
40704057 break;
40714058
40724059 case LINE_STAT_UNTRACKED:
4060 type = LINE_STAT_SECTION;
40734061 text = "Untracked files:";
40744062 break;
40754063
40764064 case LINE_STAT_NONE:
4065 type = LINE_DEFAULT;
40774066 text = " (no files)";
40784067 break;
40794068
40804069 case LINE_STAT_HEAD:
4070 type = LINE_STAT_HEAD;
40814071 text = status_onbranch;
40824072 break;
40834073