[Commits] [SCM] claws branch, master, updated. 3.17.4-32-gd7d8bd63d

wwp at claws-mail.org wwp at claws-mail.org
Fri Sep 27 10:14:18 CET 2019


The branch, master has been updated
       via  d7d8bd63dd4026e1da3f19891244ed98c2a7e9e7 (commit)
      from  68d85558184fd231e529c5fda9db540401b8f528 (commit)

Summary of changes:
 src/gtk/authors.h |  1 +
 src/textview.c    | 15 ++++++++++++---
 src/textview.h    |  3 ++-
 3 files changed, 15 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit d7d8bd63dd4026e1da3f19891244ed98c2a7e9e7
Author: wwp <subscript at free.fr>
Date:   Fri Sep 27 12:09:22 2019 +0200

    Syntax highlight improvements, patches by Jakub Kicinski (slightly
    adapted to make use of the account_sigsep_matchlist API):
    - when '-p' option is used ' @@' can be followed by function name.
    - detect git patch in body part.
    Added new contributor to authors list.
    Fix bug 4130.

diff --git a/src/gtk/authors.h b/src/gtk/authors.h
index 310d9fdf4..6c21c31bb 100644
--- a/src/gtk/authors.h
+++ b/src/gtk/authors.h
@@ -328,5 +328,6 @@ static char *CONTRIBS_LIST[] = {
 "Gál Zoltán",
 "Marien Zwart",
 "Martin Zwickel",
+"Jakub Kiciński",
 NULL
 };
diff --git a/src/textview.c b/src/textview.c
index d707a87b1..cdcdd10ee 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -1036,6 +1036,7 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
 	textview->is_in_signature = FALSE;
 	textview->is_diff = FALSE;
 	textview->is_attachment = FALSE;;
+	textview->is_in_git_patch = FALSE;
 
 	procmime_decode_content(mimeinfo);
 
@@ -1609,7 +1610,7 @@ static void textview_write_line(TextView *textview, const gchar *str,
 	}
 
 	if (prefs_common.enable_color) {
-		if (textview->is_diff) {
+		if (textview->is_diff || textview->is_in_git_patch) {
 			if (strncmp(buf, "+++ ", 4) == 0)
 				fg_color = "diff-add-file";
 			else if (buf[0] == '+')
@@ -1619,13 +1620,21 @@ static void textview_write_line(TextView *textview, const gchar *str,
 			else if (buf[0] == '-')
 				fg_color = "diff-del";
 			else if (strncmp(buf, "@@ ", 3) == 0 &&
-					strcmp(buf+strlen(buf)-4, " @@\n") == 0)
+				 strstr(&buf[3], " @@"))
 				fg_color = "diff-hunk";
-		} else if (account_sigsep_matchlist_str_found(buf,"%s\n")
+
+			if (account_signatures_matchlist_nchar_found(buf, "%s\n")
+				textview->is_in_git_patch = FALSE;
+				textview->is_in_signature = TRUE;
+				fg_color = "signature";
+			}
+		} else if (account_sigsep_matchlist_str_found(buf, "%s\n")
 				|| account_sigsep_matchlist_str_found(buf, "- %s\n")
 				|| textview->is_in_signature) {
 			fg_color = "signature";
 			textview->is_in_signature = TRUE;
+		} else if (strncmp(buf, "diff --git ", 11) == 0) {
+			textview->is_in_git_patch = TRUE;
 		}
 	}
 
diff --git a/src/textview.h b/src/textview.h
index 35393a28b..71fc91422 100644
--- a/src/textview.h
+++ b/src/textview.h
@@ -67,7 +67,8 @@ struct _TextView
 	gboolean is_in_signature;
 	gboolean is_diff;
 	gboolean is_attachment;
-	
+	gboolean is_in_git_patch;
+
 	GSList *uri_list;
 	gint body_pos;
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list