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.
This commit is contained in:
parent
019648163c
commit
fafd8ff388
3 changed files with 15 additions and 4 deletions
|
@ -328,5 +328,6 @@ static char *CONTRIBS_LIST[] = {
|
|||
"Gál Zoltán",
|
||||
"Marien Zwart",
|
||||
"Martin Zwickel",
|
||||
"Jakub Kiciński",
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -999,6 +999,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);
|
||||
|
||||
|
@ -1572,7 +1573,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] == '+')
|
||||
|
@ -1582,13 +1583,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue