Signed-off-by: Kumar Appaiah <[email protected]>
---
include/tig/diff.h | 1 +
src/diff.c | 30 ++++++++++++++++++------------
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/include/tig/diff.h b/include/tig/diff.h
index ba40386..16299fe 100644
--- a/include/tig/diff.h
+++ b/include/tig/diff.h
@@ -28,6 +28,7 @@ bool diff_common_read(struct view *view, const char *data,
struct diff_state *st
bool diff_common_draw(struct view *view, struct line *line, unsigned int
lineno);
enum request diff_common_enter(struct view *view, enum request request, struct
line *line);
bool diff_common_add_diff_stat(struct view *view, const char *data);
+void diff_common_draw_diff_stat(struct view *view, enum line_type *type, char
**text);
unsigned int diff_get_lineno(struct view *view, struct line *line);
const char *diff_get_pathname(struct view *view, struct line *line);
diff --git a/src/diff.c b/src/diff.c
index 1daf8fa..b204bab 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -167,6 +167,23 @@ diff_common_draw_part(struct view *view, enum line_type
*type, char **text, char
return sep != NULL;
}
+void
+diff_common_draw_diff_stat(struct view *view, enum line_type *type, char
**text)
+{
+ diff_common_draw_part(view, type, text, '|', LINE_DEFAULT);
+ if (diff_common_draw_part(view, type, text, 'B', LINE_DEFAULT))
{
+ /* Handle binary diffstat: Bin <deleted> -> <added>
bytes */
+ diff_common_draw_part(view, type, text, ' ',
LINE_DIFF_DEL);
+ diff_common_draw_part(view, type, text, '-',
LINE_DEFAULT);
+ diff_common_draw_part(view, type, text, ' ',
LINE_DIFF_ADD);
+ diff_common_draw_part(view, type, text, 'b',
LINE_DEFAULT);
+
+ } else {
+ diff_common_draw_part(view, type, text, '+',
LINE_DIFF_ADD);
+ diff_common_draw_part(view, type, text, '-',
LINE_DIFF_DEL);
+ }
+}
+
bool
diff_common_draw(struct view *view, struct line *line, unsigned int lineno)
{
@@ -180,18 +197,7 @@ diff_common_draw(struct view *view, struct line *line,
unsigned int lineno)
return TRUE;
if (type == LINE_DIFF_STAT) {
- diff_common_draw_part(view, &type, &text, '|', LINE_DEFAULT);
- if (diff_common_draw_part(view, &type, &text, 'B',
LINE_DEFAULT)) {
- /* Handle binary diffstat: Bin <deleted> -> <added>
bytes */
- diff_common_draw_part(view, &type, &text, ' ',
LINE_DIFF_DEL);
- diff_common_draw_part(view, &type, &text, '-',
LINE_DEFAULT);
- diff_common_draw_part(view, &type, &text, ' ',
LINE_DIFF_ADD);
- diff_common_draw_part(view, &type, &text, 'b',
LINE_DEFAULT);
-
- } else {
- diff_common_draw_part(view, &type, &text, '+',
LINE_DIFF_ADD);
- diff_common_draw_part(view, &type, &text, '-',
LINE_DIFF_DEL);
- }
+ diff_common_draw_diff_stat(view, &type, &text);
}
if (line->user_flags & DIFF_LINE_COMMIT_TITLE)
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html