[tig] [PATCH 0/3] log: colour the diffstat.

11 messages, 2 authors, 2016-06-15 · open the first message on its own page

[tig] [PATCH 0/3] log: colour the diffstat.

From: Kumar Appaiah <hidden>
Date: 2016-06-15 23:00:40

These patches add colourization to the log view. They reuse the diff
stat drawing functions from the diff module directly.

Kumar Appaiah (3):
  diff: Move diff stat addition to a common function
  diff: Move diff stat drawing to a common function
  log: Colour the diff stat

 include/tig/diff.h |  2 ++
 src/diff.c         | 57 +++++++++++++++++++++++++++++++------------------
 src/log.c          | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 98 insertions(+), 23 deletions(-)

-- 
1.9.1

[tig] [PATCH 1/3] diff: Move diff stat addition to a common function

From: Kumar Appaiah <hidden>
Date: 2016-06-15 23:00:40

Signed-off-by: Kumar Appaiah <redacted>
---
 include/tig/diff.h |  1 +
 src/diff.c         | 27 ++++++++++++++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/include/tig/diff.h b/include/tig/diff.h
index be325c4..ba40386 100644
--- a/include/tig/diff.h
+++ b/include/tig/diff.h
@@ -27,6 +27,7 @@ enum request diff_common_edit(struct view *view, enum request request, struct li
 bool diff_common_read(struct view *view, const char *data, struct diff_state *state);
 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);
 
 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 4b30068..1daf8fa 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -38,6 +38,21 @@ diff_open(struct view *view, enum open_flags flags)
 }
 
 bool
+diff_common_add_diff_stat(struct view *view, const char *data)
+{
+	size_t len = strlen(data);
+	char *pipe = strchr(data, '|');
+	bool has_histogram = data[len - 1] == '-' || data[len - 1] == '+';
+	bool has_bin_diff = pipe && strstr(pipe, "Bin") && strstr(pipe, "->");
+	bool has_rename = data[len - 1] == '0' && (strstr(data, "=>") || !strncmp(data, " ...", 4));
+	bool has_no_change = pipe && strstr(pipe, " 0");
+
+	if (pipe && (has_histogram || has_bin_diff || has_rename || has_no_change))
+		return add_line_text(view, data, LINE_DIFF_STAT) != NULL;
+	return FALSE;
+}
+
+bool
 diff_common_read(struct view *view, const char *data, struct diff_state *state)
 {
 	enum line_type type = get_line_type(data);
@@ -49,15 +64,9 @@ diff_common_read(struct view *view, const char *data, struct diff_state *state)
 		state->reading_diff_stat = TRUE;
 
 	if (state->reading_diff_stat) {
-		size_t len = strlen(data);
-		char *pipe = strchr(data, '|');
-		bool has_histogram = data[len - 1] == '-' || data[len - 1] == '+';
-		bool has_bin_diff = pipe && strstr(pipe, "Bin") && strstr(pipe, "->");
-		bool has_rename = data[len - 1] == '0' && (strstr(data, "=>") || !strncmp(data, " ...", 4));
-		bool has_no_change = pipe && strstr(pipe, " 0");
-
-		if (pipe && (has_histogram || has_bin_diff || has_rename || has_no_change)) {
-			return add_line_text(view, data, LINE_DIFF_STAT) != NULL;
+		bool ret = diff_common_add_diff_stat(view, data);
+		if (ret) {
+			return TRUE;
 		} else {
 			state->reading_diff_stat = FALSE;
 		}
-- 
1.9.1

[tig] [PATCH 3/3] log: Colour the diff stat

From: Kumar Appaiah <hidden>
Date: 2016-06-15 23:00:40

This commit adds custom log_read and log_draw functions that utilize
the diff stat drawing functions from the diff module. The absence of
the triple hyphen separator prevents direct usage of the diff drawing
functions directly.

Signed-Off-By: Kumar Appaiah <redacted>
---
 src/log.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 60 insertions(+), 2 deletions(-)
diff --git a/src/log.c b/src/log.c
index eef61dc..e6f2a82 100644
--- a/src/log.c
+++ b/src/log.c
@@ -23,6 +23,9 @@ struct log_state {
 	 * up/down in the log view. */
 	int last_lineno;
 	enum line_type last_type;
+	bool commit_title_read;
+	bool after_commit_header;
+	bool reading_diff_stat;
 };
 
 static void
@@ -76,14 +79,69 @@ log_request(struct view *view, enum request request, struct line *line)
 	}
 }
 
+static bool
+log_read(struct view *view, char *data)
+{
+	enum line_type type;
+	struct log_state *state = view->private;
+	size_t len;
+
+	if (!data)
+		return TRUE;
+
+	type = get_line_type(data);
+
+	len = strlen(data);
+
+	if (type == LINE_COMMIT)
+		state->commit_title_read = TRUE;
+	else if (state->commit_title_read && len < 1) {
+		state->commit_title_read = FALSE;
+		state->after_commit_header = TRUE;
+	} else if (state->after_commit_header && len < 1) {
+		state->after_commit_header = FALSE;
+		state->reading_diff_stat = TRUE;
+	} else if (state->reading_diff_stat) {
+		bool ret = diff_common_add_diff_stat(view, data);
+		if (ret) {
+			return TRUE;
+		} else {
+			state->reading_diff_stat = FALSE;
+		}
+	}
+
+	return pager_common_read(view, data, type);
+}
+
+static bool
+log_draw(struct view *view, struct line *line, unsigned int lineno)
+{
+	char *text = line->data;
+	enum line_type type = line->type;
+
+	if (draw_lineno(view, lineno))
+		return TRUE;
+
+	if (line->wrapped && draw_text(view, LINE_DELIMITER, "+"))
+		return TRUE;
+
+	if (type == LINE_DIFF_STAT) {
+		diff_common_draw_diff_stat(view, &type, &text);
+		draw_text(view, type, text);
+		return TRUE;
+	}
+
+	return pager_draw(view, line, lineno);
+}
+
 static struct view_ops log_ops = {
 	"line",
 	argv_env.head,
 	VIEW_ADD_PAGER_REFS | VIEW_OPEN_DIFF | VIEW_SEND_CHILD_ENTER | VIEW_LOG_LIKE | VIEW_REFRESH,
 	sizeof(struct log_state),
 	log_open,
-	pager_read,
-	pager_draw,
+	log_read,
+	log_draw,
 	log_request,
 	pager_grep,
 	log_select,
-- 
1.9.1

[tig] [PATCH 2/3] diff: Move diff stat drawing to a common function

From: Kumar Appaiah <hidden>
Date: 2016-06-15 23:00:40

Signed-off-by: Kumar Appaiah <redacted>
---
 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

[tig] [PATCHv2 1/3] diff: Move diff stat addition to a common function

From: Kumar Appaiah <hidden>
Date: 2016-06-15 23:00:41

Signed-off-by: Kumar Appaiah <redacted>
---
 include/tig/diff.h |  1 +
 src/diff.c         | 27 ++++++++++++++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/include/tig/diff.h b/include/tig/diff.h
index be325c4..ba40386 100644
--- a/include/tig/diff.h
+++ b/include/tig/diff.h
@@ -27,6 +27,7 @@ enum request diff_common_edit(struct view *view, enum request request, struct li
 bool diff_common_read(struct view *view, const char *data, struct diff_state *state);
 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);
 
 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 4b30068..1daf8fa 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -38,6 +38,21 @@ diff_open(struct view *view, enum open_flags flags)
 }
 
 bool
+diff_common_add_diff_stat(struct view *view, const char *data)
+{
+	size_t len = strlen(data);
+	char *pipe = strchr(data, '|');
+	bool has_histogram = data[len - 1] == '-' || data[len - 1] == '+';
+	bool has_bin_diff = pipe && strstr(pipe, "Bin") && strstr(pipe, "->");
+	bool has_rename = data[len - 1] == '0' && (strstr(data, "=>") || !strncmp(data, " ...", 4));
+	bool has_no_change = pipe && strstr(pipe, " 0");
+
+	if (pipe && (has_histogram || has_bin_diff || has_rename || has_no_change))
+		return add_line_text(view, data, LINE_DIFF_STAT) != NULL;
+	return FALSE;
+}
+
+bool
 diff_common_read(struct view *view, const char *data, struct diff_state *state)
 {
 	enum line_type type = get_line_type(data);
@@ -49,15 +64,9 @@ diff_common_read(struct view *view, const char *data, struct diff_state *state)
 		state->reading_diff_stat = TRUE;
 
 	if (state->reading_diff_stat) {
-		size_t len = strlen(data);
-		char *pipe = strchr(data, '|');
-		bool has_histogram = data[len - 1] == '-' || data[len - 1] == '+';
-		bool has_bin_diff = pipe && strstr(pipe, "Bin") && strstr(pipe, "->");
-		bool has_rename = data[len - 1] == '0' && (strstr(data, "=>") || !strncmp(data, " ...", 4));
-		bool has_no_change = pipe && strstr(pipe, " 0");
-
-		if (pipe && (has_histogram || has_bin_diff || has_rename || has_no_change)) {
-			return add_line_text(view, data, LINE_DIFF_STAT) != NULL;
+		bool ret = diff_common_add_diff_stat(view, data);
+		if (ret) {
+			return TRUE;
 		} else {
 			state->reading_diff_stat = FALSE;
 		}
-- 
1.9.1

[tig] [PATCHv2 2/3] diff: Move diff stat drawing to a common function

From: Kumar Appaiah <hidden>
Date: 2016-06-15 23:00:41

Signed-off-by: Kumar Appaiah <redacted>
---
 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

[tig] [PATCHv2 0/3] log: colour the diffstat

From: Kumar Appaiah <hidden>
Date: 2016-06-15 23:00:41

These patches add colourization to the log view. They reuse the diff
stat drawing functions from the diff module directly.

This version just includes some code reformatting and minor
fixes. Please comment on what other fixes could help.

Thanks.

Kumar Appaiah (3):
  diff: Move diff stat addition to a common function
  diff: Move diff stat drawing to a common function
  log: Colour the diff stat

 include/tig/diff.h |  2 ++
 src/diff.c         | 57 ++++++++++++++++++++++++++++++++++--------------------
 src/log.c          | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 91 insertions(+), 23 deletions(-)

-- 
1.9.1

[tig] [PATCHv2 3/3] log: Colour the diff stat

From: Kumar Appaiah <hidden>
Date: 2016-06-15 23:00:41

This commit adds custom log_read and log_draw functions that utilize
the diff stat drawing functions from the diff module. The absence of
the triple hyphen separator prevents direct usage of the diff drawing
functions directly.

Signed-Off-By: Kumar Appaiah <redacted>
---
 src/log.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 53 insertions(+), 2 deletions(-)
diff --git a/src/log.c b/src/log.c
index 40c9a21..468f7c3 100644
--- a/src/log.c
+++ b/src/log.c
@@ -23,6 +23,9 @@ struct log_state {
 	 * up/down in the log view. */
 	int last_lineno;
 	enum line_type last_type;
+	bool commit_title_read;
+	bool after_commit_header;
+	bool reading_diff_stat;
 };
 
 static void
@@ -78,14 +81,62 @@ log_request(struct view *view, enum request request, struct line *line)
 	}
 }
 
+static bool
+log_read(struct view *view, char *data)
+{
+	enum line_type type;
+	struct log_state *state = view->private;
+	size_t len;
+
+	if (!data)
+		return TRUE;
+
+	type = get_line_type(data);
+	len = strlen(data);
+
+	if (type == LINE_COMMIT)
+		state->commit_title_read = TRUE;
+	else if (state->commit_title_read && len < 1) {
+		state->commit_title_read = FALSE;
+		state->after_commit_header = TRUE;
+	} else if (state->after_commit_header && len < 1) {
+		state->after_commit_header = FALSE;
+		state->reading_diff_stat = TRUE;
+	} else if (state->reading_diff_stat) {
+		bool ret = diff_common_add_diff_stat(view, data);
+		if (ret) {
+			return TRUE;
+		} else {
+			state->reading_diff_stat = FALSE;
+		}
+	}
+
+	return pager_common_read(view, data, type);
+}
+
+static bool
+log_draw(struct view *view, struct line *line, unsigned int lineno)
+{
+	char *text = line->data;
+	enum line_type type = line->type;
+
+	if (type == LINE_DIFF_STAT) {
+		diff_common_draw_diff_stat(view, &type, &text);
+		draw_text(view, type, text);
+		return TRUE;
+	}
+
+	return pager_draw(view, line, lineno);
+}
+
 static struct view_ops log_ops = {
 	"line",
 	argv_env.head,
 	VIEW_ADD_PAGER_REFS | VIEW_OPEN_DIFF | VIEW_SEND_CHILD_ENTER | VIEW_LOG_LIKE | VIEW_REFRESH,
 	sizeof(struct log_state),
 	log_open,
-	pager_read,
-	pager_draw,
+	log_read,
+	log_draw,
 	log_request,
 	pager_grep,
 	log_select,
-- 
1.9.1

Re: [tig] [PATCHv2 3/3] log: Colour the diff stat

From: Jonas Fonseca <hidden>
Date: 2016-06-15 23:00:43

On Sun, Apr 13, 2014 at 5:54 PM, Kumar Appaiah
[off-list ref] wrote:
This commit adds custom log_read and log_draw functions that utilize
the diff stat drawing functions from the diff module. The absence of
the triple hyphen separator prevents direct usage of the diff drawing
functions directly.
See my comments below.
quoted hunk
---
 src/log.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 53 insertions(+), 2 deletions(-)
diff --git a/src/log.c b/src/log.c
index 40c9a21..468f7c3 100644
--- a/src/log.c
+++ b/src/log.c
@@ -23,6 +23,9 @@ struct log_state {
         * up/down in the log view. */
        int last_lineno;
        enum line_type last_type;
+       bool commit_title_read;
+       bool after_commit_header;
+       bool reading_diff_stat;
 };

 static void
@@ -78,14 +81,62 @@ log_request(struct view *view, enum request request, struct line *line)
        }
 }

+static bool
+log_read(struct view *view, char *data)
+{
+       enum line_type type;
+       struct log_state *state = view->private;
+       size_t len;
+
+       if (!data)
+               return TRUE;
+
+       type = get_line_type(data);
+       len = strlen(data);
+
+       if (type == LINE_COMMIT)
+               state->commit_title_read = TRUE;
+       else if (state->commit_title_read && len < 1) {
+               state->commit_title_read = FALSE;
+               state->after_commit_header = TRUE;
+       } else if (state->after_commit_header && len < 1) {
+               state->after_commit_header = FALSE;
+               state->reading_diff_stat = TRUE;
+       } else if (state->reading_diff_stat) {
+               bool ret = diff_common_add_diff_stat(view, data);
+               if (ret) {
+                       return TRUE;
+               } else {
+                       state->reading_diff_stat = FALSE;
+               }
+       }
+
+       return pager_common_read(view, data, type);
+}
+
+static bool
+log_draw(struct view *view, struct line *line, unsigned int lineno)
+{
+       char *text = line->data;
+       enum line_type type = line->type;
+
This is missing a call to draw_lineno(...)
+       if (type == LINE_DIFF_STAT) {
+               diff_common_draw_diff_stat(view, &type, &text);
+               draw_text(view, type, text);
I had to #include "tig/draw.h" for this to compile.
+               return TRUE;
+       }
+
+       return pager_draw(view, line, lineno);
+}
+
 static struct view_ops log_ops = {
        "line",
        argv_env.head,
        VIEW_ADD_PAGER_REFS | VIEW_OPEN_DIFF | VIEW_SEND_CHILD_ENTER | VIEW_LOG_LIKE | VIEW_REFRESH,
        sizeof(struct log_state),
        log_open,
-       pager_read,
-       pager_draw,
+       log_read,
+       log_draw,
        log_request,
        pager_grep,
        log_select,
--
1.9.1


-- 
Jonas Fonseca

Re: [tig] [PATCHv2 0/3] log: colour the diffstat

From: Jonas Fonseca <hidden>
Date: 2016-06-15 23:00:43

Hi Kumar,

On Sun, Apr 13, 2014 at 5:54 PM, Kumar Appaiah
[off-list ref] wrote:
These patches add colourization to the log view. They reuse the diff
stat drawing functions from the diff module directly.
This is a great idea. I wonder though if it would make sense to put
this into the pager backend instead so all pager based views can
benefit unless of course the "state machine" would end up becoming too
complicated.
This version just includes some code reformatting and minor
fixes. Please comment on what other fixes could help.
See my other email regarding fixes. Since I am currently refactoring
how views are drawn I'd prefer to postpone merging this patchset until
the dust has settled. I'll try to rebase the patches once I get there
before reaching out to you.

-- 
Jonas Fonseca

Re: [tig] [PATCHv2 3/3] log: Colour the diff stat

From: Kumar Appaiah <hidden>
Date: 2016-06-15 23:00:43

On Wed, Apr 16, 2014 at 08:44:41PM -0400, Jonas Fonseca wrote:
On Sun, Apr 13, 2014 at 5:54 PM, Kumar Appaiah
[off-list ref] wrote:
quoted
This commit adds custom log_read and log_draw functions that utilize
the diff stat drawing functions from the diff module. The absence of
the triple hyphen separator prevents direct usage of the diff drawing
functions directly.
See my comments below.
Hi Jonas.
quoted
+static bool
+log_draw(struct view *view, struct line *line, unsigned int lineno)
+{
+       char *text = line->data;
+       enum line_type type = line->type;
+
This is missing a call to draw_lineno(...)
Noted.
quoted
+       if (type == LINE_DIFF_STAT) {
+               diff_common_draw_diff_stat(view, &type, &text);
+               draw_text(view, type, text);
I had to #include "tig/draw.h" for this to compile.
I'll take care of this.

I'll send you a pull request eventually. You can handle it after your
refactor is complete.

Thanks!

Kumar
-- 
Kumar Appaiah
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help