Skip to content

Commit dd53e99

Browse files
committed
Mark all added/removed lines in column 0
1 parent 85377c3 commit dd53e99

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

doc/tigrc.5.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,10 @@ The following variables can be set:
275275
Hide the leading `+` and `-` signs in diff output. Copy-paste of lines
276276
from the diff view may be aided by this option. Enabling this only makes
277277
sense when coloring is used to distinguish added and removed lines.
278-
Removed and added empty lines are indicated by a space highlighted by
279-
the color `diff-add-highlight` or `diff-del-highlight`, respectively.
280-
Keeping the `standout` (reverse) property set for these is suggested, as
281-
white space is otherwise invisible. Off by default.
278+
Removed and added lines are indicated in the first column by a space
279+
highlighted by the color `diff-add-highlight` or `diff-del-highlight`,
280+
respectively. Keeping the `standout` (reverse) property set for these is
281+
suggested, as white space is otherwise invisible. Off by default.
282282
283283
'diff-highlight' (mixed)::
284284

src/draw.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,15 @@ draw_chars(struct view *view, enum line_type type, const char *string, int lengt
8080
view->col == 0 &&
8181
(type == LINE_DIFF_ADD || type == LINE_DIFF_DEL)
8282
) {
83-
if (len == 1) { // highlight empty lines by the highlight propery
84-
if (type == LINE_DIFF_ADD)
85-
set_view_attr(view, LINE_DIFF_ADD_HIGHLIGHT);
86-
else if (type == LINE_DIFF_DEL)
87-
set_view_attr(view, LINE_DIFF_DEL_HIGHLIGHT);
88-
}
83+
/* Mark first column by color-only for add/del line */
84+
if (type == LINE_DIFF_ADD)
85+
set_view_attr(view, LINE_DIFF_ADD_HIGHLIGHT);
86+
else if (type == LINE_DIFF_DEL)
87+
set_view_attr(view, LINE_DIFF_DEL_HIGHLIGHT);
8988
waddnstr(view->win, " ", 1);
89+
90+
/* Add the actual diff line */
91+
set_view_attr(view, type);
9092
waddnstr(view->win, string+1, len-1);
9193
} else {
9294
waddnstr(view->win, string, len);

0 commit comments

Comments
 (0)