{"thread":{"id":"42696","subject":"Italics formatting","startedAt":"2016-06-23T11:54:41Z","lastAt":"2016-06-23T19:56:15Z","messageCount":24,"participants":["Simon Courtois","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"289946","messageId":"etPan.576bcdfa.7aee6fa4.9bf5@cubyx.fr","threadId":"42696","inReplyTo":null,"subject":"Italics formatting","fromName":"Simon Courtois","fromEmail":"scourtois@cubyx.fr","sentAt":"2016-06-23T11:54:34Z","receivedAt":"2016-06-23T11:54:41Z","isPatch":false,"sender":{"key":"scourtois@cubyx.fr","avatar":null},"body":"Hi,\n\nI was looking for a way to use italics in my git log. I ended-up looking at the code dealing with colors and style and noticed that the italic code was skipped when defining the list (color.c:128 if I'm not mistaken).\n\nI'd love to propose a contribution but I'm sadly not very well versed with C.\n\nSo I'm asking you if this could be something that's part of Git someday. I don't know the extent of dim/ul/blink support across the terms but since some of them support italics the style would have its rightful place amongst the others.\n\nAnd I'd also like to take the occasion to thank everybody working on Git, I've been using it for 7 years now and it's a real pleasure! Thank you all.\n\nRegards,\n\nSimon Courtois\n\n"},{"id":"289947","messageId":"20160623130828.GA25209@sigill.intra.peff.net","threadId":"42696","inReplyTo":"etPan.576bcdfa.7aee6fa4.9bf5@cubyx.fr","subject":"[PATCH 0/2] more ANSI attributes","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T13:08:29Z","receivedAt":"2016-06-23T13:08:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 23, 2016 at 01:54:34PM +0200, Simon Courtois wrote:\n\n> I was looking for a way to use italics in my git log. I ended-up\n> looking at the code dealing with colors and style and noticed that the\n> italic code was skipped when defining the list (color.c:128 if I'm not\n> mistaken).\n> \n> I'd love to propose a contribution but I'm sadly not very well versed\n> with C.\n\nMy first suggestion was going to be that you can feed arbitrary numbers\nyourself, without git having to have a name for it. But that is true\nonly of colors, not attributes. So it does need a patch.\n\nHere is one, along with a minor cleanup. I think the attributes we don't\nsupport now are:\n\n  - 6; rapid blink (not supported by xterm)\n  - 8; conceal (supported, but why would you want it?)\n  - 9; crossed-out (supported, and at least plausible to want?)\n\nWe also don't support font-selection (10-19, or 20 for Fraktur) which\nare not supported by xterm (of course xterm support is not the defining\ncriterion, if people have other terms that do support it. My point is\nmostly \"nobody is asking for it, and it is not even in xterm\").\n\n  [1/2]: color: fix max-size comment\n  [2/2]: color: support \"italic\" attribute\n\n-Peff\n"},{"id":"289948","messageId":"20160623130955.GA12653@sigill.intra.peff.net","threadId":"42696","inReplyTo":"20160623130828.GA25209@sigill.intra.peff.net","subject":"[PATCH 1/2] color: fix max-size comment","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T13:09:55Z","receivedAt":"2016-06-23T13:10:01Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We use fixed-size buffers for colors, because we know our\nparsing cannot grow beyond a particular bound. However, our\ncomment describing the max-size has two issues:\n\n  1. It has the description in two forms: a short one, and\n     one with more explanation. Over time the latter has\n     been updated, but the former has not. Let's just drop\n     the short one (after making sure everything it says\n     is in the long one).\n\n  2. As of ff40d18 (parse_color: recognize \"no$foo\" to clear\n     the $foo attribute, 2014-11-20), the per-attribute size\n     bumped to \"3\" (because \"nobold\" is actually \"21;\"). But\n     that's not quite enough, as somebody may use both\n     \"bold\" and \"nobold\", requiring 5 characters.\n\n     This wasn't a problem for the final count, because we\n     over-estimated in other ways, but let's clarify how we\n     got to the final number.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n color.h | 12 +++++++-----\n 1 file changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/color.h b/color.h\nindex e155d13..e24fa0b 100644\n--- a/color.h\n+++ b/color.h\n@@ -3,18 +3,20 @@\n \n struct strbuf;\n \n-/*  2 + (2 * num_attrs) + 8 + 1 + 8 + 'm' + NUL */\n-/* \"\\033[1;2;4;5;7;38;5;2xx;48;5;2xxm\\0\" */\n /*\n  * The maximum length of ANSI color sequence we would generate:\n  * - leading ESC '['            2\n- * - attr + ';'                 3 * 10 (e.g. \"1;\")\n+ * - attr + ';'                 2 * num_attr (e.g. \"1;\")\n+ * - no-attr + ';'              3 * num_attr (e.g. \"22;\")\n  * - fg color + ';'             17 (e.g. \"38;2;255;255;255;\")\n  * - bg color + ';'             17 (e.g. \"48;2;255;255;255;\")\n  * - terminating 'm' NUL        2\n  *\n- * The above overcounts attr (we only use 5 not 8) and one semicolon\n- * but it is close enough.\n+ * The above overcounts by one semicolon but it is close enough.\n+ *\n+ * The space for attributes is also slightly overallocated, as\n+ * the negation for some attributes is the same (e.g., nobold and nodim).\n+ * We also allocate space for 6 attributes (even though we have only 5).\n  */\n #define COLOR_MAXLEN 70\n \n-- \n2.9.0.209.g845fbc1\n\n"},{"id":"289949","messageId":"20160623131028.GB12653@sigill.intra.peff.net","threadId":"42696","inReplyTo":"20160623130828.GA25209@sigill.intra.peff.net","subject":"[PATCH 2/2] color: support \"italic\" attribute","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T13:10:28Z","receivedAt":"2016-06-23T13:10:38Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We already support bold, underline, and similar attributes.\nLet's add italic to the mix.  According to the Wikipedia\npage on ANSI colors, this attribute is \"not widely\nsupported\", but it does seem to work on my xterm.\n\nWe don't have to bump the maximum color size because we were\nalready over-allocating it (but we do adjust the comment\nappropriately).\n\nRequested-by: Simon Courtois <scourtois@cubyx.fr>\nSigned-off-by: Jeff King <peff@peff.net>\n---\n Documentation/config.txt | 2 +-\n color.c                  | 8 ++++----\n color.h                  | 3 ++-\n t/t4026-color.sh         | 4 ++--\n 4 files changed, 9 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 58673cf..4b97d8d 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -154,7 +154,7 @@ color::\n        colors (at most two) and attributes (at most one), separated\n        by spaces.  The colors accepted are `normal`, `black`,\n        `red`, `green`, `yellow`, `blue`, `magenta`, `cyan` and\n-       `white`; the attributes are `bold`, `dim`, `ul`, `blink` and\n+       `white`; the attributes are `bold`, `dim`, `italic`, `ul`, `blink` and\n        `reverse`.  The first color given is the foreground; the\n        second is the background.  The position of the attribute, if\n        any, doesn't matter. Attributes may be turned off specifically\ndiff --git a/color.c b/color.c\nindex 8f85153..698682c 100644\n--- a/color.c\n+++ b/color.c\n@@ -125,11 +125,11 @@ static int parse_color(struct color *out, const char *name, int len)\n \n static int parse_attr(const char *name, int len)\n {\n-\tstatic const int attr_values[] = { 1, 2, 4, 5, 7,\n-\t\t\t\t\t   22, 22, 24, 25, 27 };\n+\tstatic const int attr_values[] = { 1, 2, 3, 4, 5, 7,\n+\t\t\t\t\t   22, 22, 23, 24, 25, 27 };\n \tstatic const char * const attr_names[] = {\n-\t\t\"bold\", \"dim\", \"ul\", \"blink\", \"reverse\",\n-\t\t\"nobold\", \"nodim\", \"noul\", \"noblink\", \"noreverse\"\n+\t\t\"bold\", \"dim\", \"italic\", \"ul\", \"blink\", \"reverse\",\n+\t\t\"nobold\", \"nodim\", \"noitalic\", \"noul\", \"noblink\", \"noreverse\"\n \t};\n \tint i;\n \tfor (i = 0; i < ARRAY_SIZE(attr_names); i++) {\ndiff --git a/color.h b/color.h\nindex e24fa0b..3af01a6 100644\n--- a/color.h\n+++ b/color.h\n@@ -16,7 +16,8 @@ struct strbuf;\n  *\n  * The space for attributes is also slightly overallocated, as\n  * the negation for some attributes is the same (e.g., nobold and nodim).\n- * We also allocate space for 6 attributes (even though we have only 5).\n+ *\n+ * We allocate space for 6 attributes.\n  */\n #define COLOR_MAXLEN 70\n \ndiff --git a/t/t4026-color.sh b/t/t4026-color.sh\nindex 2b32c4f..05625c5 100755\n--- a/t/t4026-color.sh\n+++ b/t/t4026-color.sh\n@@ -56,8 +56,8 @@ test_expect_success 'long color specification' '\n \n test_expect_success 'absurdly long color specification' '\n \tcolor \\\n-\t  \"#ffffff #ffffff bold nobold dim nodim ul noul blink noblink reverse noreverse\" \\\n-\t  \"[1;2;4;5;7;22;24;25;27;38;2;255;255;255;48;2;255;255;255m\"\n+\t  \"#ffffff #ffffff bold nobold dim nodim italic noitalic ul noul blink noblink reverse noreverse\" \\\n+\t  \"[1;2;3;4;5;7;22;23;24;25;27;38;2;255;255;255;48;2;255;255;255m\"\n '\n \n test_expect_success '0-7 are aliases for basic ANSI color names' '\n-- \n2.9.0.209.g845fbc1\n"},{"id":"289951","messageId":"etPan.576beae6.5440514e.9bf5@cubyx.fr","threadId":"42696","inReplyTo":"20160623131028.GB12653@sigill.intra.peff.net","subject":"Re: [PATCH 2/2] color: support \"italic\" attribute","fromName":"Simon Courtois","fromEmail":"scourtois@cubyx.fr","sentAt":"2016-06-23T13:57:58Z","receivedAt":"2016-06-23T13:58:07Z","isPatch":true,"sender":{"key":"scourtois@cubyx.fr","avatar":null},"body":"Wow I wasn't expecting such a rapid response, you're awesome! :-D\n\nSimon Courtois\n\nOn 23 June 2016 at 15:10:33, Jeff King (peff@peff.net) wrote:\n> We already support bold, underline, and similar attributes.\n> Let's add italic to the mix. According to the Wikipedia\n> page on ANSI colors, this attribute is \"not widely\n> supported\", but it does seem to work on my xterm.\n> \n> We don't have to bump the maximum color size because we were\n> already over-allocating it (but we do adjust the comment\n> appropriately).\n> \n> Requested-by: Simon Courtois \n> Signed-off-by: Jeff King \n> ---\n> Documentation/config.txt | 2 +-\n> color.c | 8 ++++----\n> color.h | 3 ++-\n> t/t4026-color.sh | 4 ++--\n> 4 files changed, 9 insertions(+), 8 deletions(-)\n> \n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index 58673cf..4b97d8d 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -154,7 +154,7 @@ color::\n> colors (at most two) and attributes (at most one), separated\n> by spaces. The colors accepted are `normal`, `black`,\n> `red`, `green`, `yellow`, `blue`, `magenta`, `cyan` and\n> - `white`; the attributes are `bold`, `dim`, `ul`, `blink` and\n> + `white`; the attributes are `bold`, `dim`, `italic`, `ul`, `blink` and\n> `reverse`. The first color given is the foreground; the\n> second is the background. The position of the attribute, if\n> any, doesn't matter. Attributes may be turned off specifically\n> diff --git a/color.c b/color.c\n> index 8f85153..698682c 100644\n> --- a/color.c\n> +++ b/color.c\n> @@ -125,11 +125,11 @@ static int parse_color(struct color *out, const char *name, int \n> len)\n> \n> static int parse_attr(const char *name, int len)\n> {\n> - static const int attr_values[] = { 1, 2, 4, 5, 7,\n> - 22, 22, 24, 25, 27 };\n> + static const int attr_values[] = { 1, 2, 3, 4, 5, 7,\n> + 22, 22, 23, 24, 25, 27 };\n> static const char * const attr_names[] = {\n> - \"bold\", \"dim\", \"ul\", \"blink\", \"reverse\",\n> - \"nobold\", \"nodim\", \"noul\", \"noblink\", \"noreverse\"\n> + \"bold\", \"dim\", \"italic\", \"ul\", \"blink\", \"reverse\",\n> + \"nobold\", \"nodim\", \"noitalic\", \"noul\", \"noblink\", \"noreverse\"\n> };\n> int i;\n> for (i = 0; i < ARRAY_SIZE(attr_names); i++) {\n> diff --git a/color.h b/color.h\n> index e24fa0b..3af01a6 100644\n> --- a/color.h\n> +++ b/color.h\n> @@ -16,7 +16,8 @@ struct strbuf;\n> *\n> * The space for attributes is also slightly overallocated, as\n> * the negation for some attributes is the same (e.g., nobold and nodim).\n> - * We also allocate space for 6 attributes (even though we have only 5).\n> + *\n> + * We allocate space for 6 attributes.\n> */\n> #define COLOR_MAXLEN 70\n> \n> diff --git a/t/t4026-color.sh b/t/t4026-color.sh\n> index 2b32c4f..05625c5 100755\n> --- a/t/t4026-color.sh\n> +++ b/t/t4026-color.sh\n> @@ -56,8 +56,8 @@ test_expect_success 'long color specification' '\n> \n> test_expect_success 'absurdly long color specification' '\n> color \\\n> - \"#ffffff #ffffff bold nobold dim nodim ul noul blink noblink reverse noreverse\" \\\n> - \"[1;2;4;5;7;22;24;25;27;38;2;255;255;255;48;2;255;255;255m\"\n> + \"#ffffff #ffffff bold nobold dim nodim italic noitalic ul noul blink noblink reverse \n> noreverse\" \\\n> + \"[1;2;3;4;5;7;22;23;24;25;27;38;2;255;255;255;48;2;255;255;255m\"\n> '\n> \n> test_expect_success '0-7 are aliases for basic ANSI color names' '\n> --\n> 2.9.0.209.g845fbc1\n> \n\n"},{"id":"289967","messageId":"xmqq7fdfkg3i.fsf@gitster.mtv.corp.google.com","threadId":"42696","inReplyTo":"20160623131028.GB12653@sigill.intra.peff.net","subject":"Re: [PATCH 2/2] color: support \"italic\" attribute","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-23T16:46:57Z","receivedAt":"2016-06-23T16:47:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> We already support bold, underline, and similar attributes.\n> Let's add italic to the mix.  According to the Wikipedia\n> page on ANSI colors, this attribute is \"not widely\n> supported\", but it does seem to work on my xterm.\n>\n> We don't have to bump the maximum color size because we were\n> already over-allocating it (but we do adjust the comment\n> appropriately).\n>\n> Requested-by: Simon Courtois <scourtois@cubyx.fr>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  Documentation/config.txt | 2 +-\n>  color.c                  | 8 ++++----\n>  color.h                  | 3 ++-\n>  t/t4026-color.sh         | 4 ++--\n>  4 files changed, 9 insertions(+), 8 deletions(-)\n>\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index 58673cf..4b97d8d 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -154,7 +154,7 @@ color::\n>         colors (at most two) and attributes (at most one), separated\n\nThis is describing the format accepted by color_parse_mem(), whose\nmain loop has /* [fg [bg]] [attr]... */ comment in front?\n\nIs \"at most one\" still correct, or it was already stale before this\npatch?\n\n"},{"id":"289968","messageId":"20160623164751.GA29882@sigill.intra.peff.net","threadId":"42696","inReplyTo":"xmqq7fdfkg3i.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 2/2] color: support \"italic\" attribute","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T16:47:52Z","receivedAt":"2016-06-23T16:47:58Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 23, 2016 at 09:46:57AM -0700, Junio C Hamano wrote:\n\n> > diff --git a/Documentation/config.txt b/Documentation/config.txt\n> > index 58673cf..4b97d8d 100644\n> > --- a/Documentation/config.txt\n> > +++ b/Documentation/config.txt\n> > @@ -154,7 +154,7 @@ color::\n> >         colors (at most two) and attributes (at most one), separated\n> \n> This is describing the format accepted by color_parse_mem(), whose\n> main loop has /* [fg [bg]] [attr]... */ comment in front?\n> \n> Is \"at most one\" still correct, or it was already stale before this\n> patch?\n\nI think it was already stale.\n\nI'm actually preparing a re-roll that makes some of the parsing a bit\nless nasty, too. I'll fix that at the same time.\n\n-Peff\n"},{"id":"289971","messageId":"20160623173048.GA19923@sigill.intra.peff.net","threadId":"42696","inReplyTo":"20160623130828.GA25209@sigill.intra.peff.net","subject":"[PATCH v2 0/7] more ANSI attributes","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T17:30:48Z","receivedAt":"2016-06-23T17:30:54Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Here's a re-roll of my earlier patches to add \"italic\" support.\n\nIt fixes the documentation problem Junio mentioned (along with some\nother issues there). It also cleans up parse_attr() to make it a bit\neasier to read and maintain, and adds a few more features.\n\n  [1/7]: color: fix max-size comment\n  [2/7]: doc: refactor description of color format\n  [3/7]: add skip_prefix_mem helper\n  [4/7]: color: refactor parse_attr\n  [5/7]: color: allow \"no-\" for negating attributes\n  [6/7]: color: support \"italic\" attribute\n  [7/7]: color: support strike-through attribute\n\n-Peff\n"},{"id":"289972","messageId":"20160623173144.GA15774@sigill.intra.peff.net","threadId":"42696","inReplyTo":"20160623173048.GA19923@sigill.intra.peff.net","subject":"[PATCH v2 1/7] color: fix max-size comment","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T17:31:44Z","receivedAt":"2016-06-23T17:31:49Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We use fixed-size buffers for colors, because we know our\nparsing cannot grow beyond a particular bound. However, our\ncomment description has two issues:\n\n  1. It has the description in two forms: a short one, and\n     one with more explanation. Over time the latter has\n     been updated, but the former has not. Let's just drop\n     the short one (after making sure everything it says\n     is in the long one).\n\n  2. As of ff40d18 (parse_color: recognize \"no$foo\" to clear\n     the $foo attribute, 2014-11-20), the per-attribute size\n     bumped to \"3\" (because \"nobold\" is actually \"21;\"). But\n     that's not quite enough, as somebody may use both\n     \"bold\" and \"nobold\", requiring 5 characters.\n\n     This wasn't a problem for the final count, because we\n     over-estimated in other ways, but let's clarify how we\n     got to the final number.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nUnchanged from v1.\n\n color.h | 12 +++++++-----\n 1 file changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/color.h b/color.h\nindex e155d13..e24fa0b 100644\n--- a/color.h\n+++ b/color.h\n@@ -3,18 +3,20 @@\n \n struct strbuf;\n \n-/*  2 + (2 * num_attrs) + 8 + 1 + 8 + 'm' + NUL */\n-/* \"\\033[1;2;4;5;7;38;5;2xx;48;5;2xxm\\0\" */\n /*\n  * The maximum length of ANSI color sequence we would generate:\n  * - leading ESC '['            2\n- * - attr + ';'                 3 * 10 (e.g. \"1;\")\n+ * - attr + ';'                 2 * num_attr (e.g. \"1;\")\n+ * - no-attr + ';'              3 * num_attr (e.g. \"22;\")\n  * - fg color + ';'             17 (e.g. \"38;2;255;255;255;\")\n  * - bg color + ';'             17 (e.g. \"48;2;255;255;255;\")\n  * - terminating 'm' NUL        2\n  *\n- * The above overcounts attr (we only use 5 not 8) and one semicolon\n- * but it is close enough.\n+ * The above overcounts by one semicolon but it is close enough.\n+ *\n+ * The space for attributes is also slightly overallocated, as\n+ * the negation for some attributes is the same (e.g., nobold and nodim).\n+ * We also allocate space for 6 attributes (even though we have only 5).\n  */\n #define COLOR_MAXLEN 70\n \n-- \n2.9.0.209.g845fbc1\n\n"},{"id":"289973","messageId":"20160623173229.GB15774@sigill.intra.peff.net","threadId":"42696","inReplyTo":"20160623173048.GA19923@sigill.intra.peff.net","subject":"[PATCH v2 2/7] doc: refactor description of color format","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T17:32:30Z","receivedAt":"2016-06-23T17:32:35Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is a general cleanup of the description of colors in\ngit-config, mostly to address inaccuracies and confusion\nthat had grown over time:\n\n  - you can have many attributes, not just one\n\n  - the discussion flip-flopped between colors and\n    attributes; now we discuss everything about colors, then\n    everything about attributes\n\n  - many concepts were lumped into the first paragraph,\n    making it hard to read, and especially to find the\n    actual lists of colors and attributes. I stopped short\n    of breaking those out into their own lists, as it seemed\n    like an excessive use of vertical screen real estate.\n\n  - we introduced negated attributes, but then the next\n    paragraph basically explains how each item starts off\n    with no attributes. So why would one need negated\n    attributes? We now explain.\n\n  - minor typo, language, and typography fixes\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n Documentation/config.txt | 47 ++++++++++++++++++++++++++---------------------\n 1 file changed, 26 insertions(+), 21 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 58673cf..f8460d4 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -150,27 +150,32 @@ integer::\n        1024\", \"by 1024x1024\", etc.\n \n color::\n-       The value for a variables that takes a color is a list of\n-       colors (at most two) and attributes (at most one), separated\n-       by spaces.  The colors accepted are `normal`, `black`,\n-       `red`, `green`, `yellow`, `blue`, `magenta`, `cyan` and\n-       `white`; the attributes are `bold`, `dim`, `ul`, `blink` and\n-       `reverse`.  The first color given is the foreground; the\n-       second is the background.  The position of the attribute, if\n-       any, doesn't matter. Attributes may be turned off specifically\n-       by prefixing them with `no` (e.g., `noreverse`, `noul`, etc).\n-+\n-Colors (foreground and background) may also be given as numbers between\n-0 and 255; these use ANSI 256-color mode (but note that not all\n-terminals may support this).  If your terminal supports it, you may also\n-specify 24-bit RGB values as hex, like `#ff0ab3`.\n-+\n-The attributes are meant to be reset at the beginning of each item\n-in the colored output, so setting color.decorate.branch to `black`\n-will paint that branch name in a plain `black`, even if the previous\n-thing on the same output line (e.g. opening parenthesis before the\n-list of branch names in `log --decorate` output) is set to be\n-painted with `bold` or some other attribute.\n+       The value for a variable that takes a color is a list of\n+       colors (at most two, one for foreground and one for background)\n+       and attributes (as many as you want), separated by spaces.\n++\n+The basic colors accepted are `normal`, `black`, `red`, `green`, `yellow`,\n+`blue`, `magenta`, `cyan` and `white`.  The first color given is the\n+foreground; the second is the background.\n++\n+Colors may also be given as numbers between 0 and 255; these use ANSI\n+256-color mode (but note that not all terminals may support this).  If\n+your terminal supports it, you may also specify 24-bit RGB values as\n+hex, like `#ff0ab3`.\n++\n+The accepted attributes are `bold`, `dim`, `ul`, `blink`, and `reverse`.\n+The position of any attributes with respect to the colors (before, after,\n+or in between), doesn't matter. Specific attributes may be turned off\n+by prefixing them with `no` (e.g., `noreverse`, `noul`, etc).\n++\n+For git's pre-defined color slots, the attributes are meant to be reset\n+at the beginning of each item in the colored output. So setting\n+`color.decorate.branch` to `black` will paint that branch name in a\n+plain `black`, even if the previous thing on the same output line (e.g.\n+opening parenthesis before the list of branch names in `log --decorate`\n+output) is set to be painted with `bold` or some other attribute.\n+However, custom log formats may do more complicated and layered\n+coloring, and the negated forms may be useful there.\n \n pathname::\n \tA variable that takes a pathname value can be given a\n-- \n2.9.0.209.g845fbc1\n\n"},{"id":"289974","messageId":"20160623173357.GC15774@sigill.intra.peff.net","threadId":"42696","inReplyTo":"20160623173048.GA19923@sigill.intra.peff.net","subject":"[PATCH v2 3/7] add skip_prefix_mem helper","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T17:33:57Z","receivedAt":"2016-06-23T17:34:03Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The skip_prefix function has been very useful for\nsimplifying pointer arithmetic and avoiding repeated magic\nnumbers, but we have no equivalent for length-limited\nbuffers. So we're stuck with:\n\n  if (3 <= len && skip_prefix(buf, \"foo\", &buf))\n\t  len -= 3;\n\nThat's not that complicated, but it needs to use magic\nnumbers for the length of the prefix (or else write out\nstrlen(\"foo\"), repeating the string). By using a helper, we\ncan get the string length behind the scenes (and often at\ncompile time for string literals).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nObviously a helper to be used later in the series. I didn't hunt around\nfor other places that could make use of it, but I suspect there are\nsome.\n\n git-compat-util.h | 17 +++++++++++++++++\n 1 file changed, 17 insertions(+)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 49d4029..c99cddc 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -473,6 +473,23 @@ static inline int skip_prefix(const char *str, const char *prefix,\n \treturn 0;\n }\n \n+/*\n+ * Like skip_prefix, but promises never to read past \"len\" bytes of the input\n+ * buffer, and returns the remaining number of bytes in \"out\" via \"outlen\".\n+ */\n+static inline int skip_prefix_mem(const char *buf, size_t len,\n+\t\t\t\t  const char *prefix,\n+\t\t\t\t  const char **out, size_t *outlen)\n+{\n+\tsize_t prefix_len = strlen(prefix);\n+\tif (prefix_len <= len && !memcmp(buf, prefix, prefix_len)) {\n+\t\t*out = buf + prefix_len;\n+\t\t*outlen = len - prefix_len;\n+\t\treturn 1;\n+\t}\n+\treturn 0;\n+}\n+\n /*\n  * If buf ends with suffix, return 1 and subtract the length of the suffix\n  * from *len. Otherwise, return 0 and leave *len untouched.\n-- \n2.9.0.209.g845fbc1\n\n"},{"id":"289977","messageId":"20160623173812.GD15774@sigill.intra.peff.net","threadId":"42696","inReplyTo":"20160623173048.GA19923@sigill.intra.peff.net","subject":"[PATCH v2 4/7] color: refactor parse_attr","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T17:38:13Z","receivedAt":"2016-06-23T17:38:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The list of attributes we recognize is a bit unwieldy, as we\nactually have two arrays that must be kept in sync. Instead,\nlet's have a single array-of-struct to represent our\nmapping. That means we can never have an accident that\ncauses us to read off the end of an array, and it makes\ndiffs for adding new attributes much easier to read.\n\nThis also makes it easy to handle the \"no\" cases without\nhaving to repeat each attribute (this shortens the list,\nmaking it easier to read, but also also cuts the size of our\nlinear search in half). Technically this makes it impossible\nfor us to add an attribute that starts with \"no\" (we could\nconfuse \"nobody\" for the negation of \"body\"), but since this\nis a constrained set of attributes, that's OK.\n\nSince we can also store the length of each name in the\nstruct, that makes it easy for us to avoid reading past the\n\"len\" parameter given to us (though in practice it was not a\nbug, since all of our current callers are interested in a\nsubset of a NUL-terminated buffer, not a true undelimited\nrange of memory).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n color.c | 31 +++++++++++++++++++++----------\n 1 file changed, 21 insertions(+), 10 deletions(-)\n\ndiff --git a/color.c b/color.c\nindex 8f85153..d787dec 100644\n--- a/color.c\n+++ b/color.c\n@@ -123,19 +123,30 @@ static int parse_color(struct color *out, const char *name, int len)\n \treturn -1;\n }\n \n-static int parse_attr(const char *name, int len)\n+static int parse_attr(const char *name, size_t len)\n {\n-\tstatic const int attr_values[] = { 1, 2, 4, 5, 7,\n-\t\t\t\t\t   22, 22, 24, 25, 27 };\n-\tstatic const char * const attr_names[] = {\n-\t\t\"bold\", \"dim\", \"ul\", \"blink\", \"reverse\",\n-\t\t\"nobold\", \"nodim\", \"noul\", \"noblink\", \"noreverse\"\n+\tstatic const struct {\n+\t\tconst char *name;\n+\t\tsize_t len;\n+\t\tint val, neg;\n+\t} attrs[] = {\n+#define ATTR(x, val, neg) { (x), sizeof(x)-1, (val), (neg) }\n+\t\tATTR(\"bold\",      1, 22),\n+\t\tATTR(\"dim\",       2, 22),\n+\t\tATTR(\"ul\",        4, 24),\n+\t\tATTR(\"blink\",     5, 25),\n+\t\tATTR(\"reverse\",   7, 27)\n+#undef ATTR\n \t};\n+\tint negate = 0;\n \tint i;\n-\tfor (i = 0; i < ARRAY_SIZE(attr_names); i++) {\n-\t\tconst char *str = attr_names[i];\n-\t\tif (!strncasecmp(name, str, len) && !str[len])\n-\t\t\treturn attr_values[i];\n+\n+\tif (skip_prefix_mem(name, len, \"no\", &name, &len))\n+\t\tnegate = 1;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(attrs); i++) {\n+\t\tif (attrs[i].len == len && !memcmp(attrs[i].name, name, len))\n+\t\t\treturn negate ? attrs[i].neg : attrs[i].val;\n \t}\n \treturn -1;\n }\n-- \n2.9.0.209.g845fbc1\n\n"},{"id":"289978","messageId":"20160623173844.GE15774@sigill.intra.peff.net","threadId":"42696","inReplyTo":"20160623173048.GA19923@sigill.intra.peff.net","subject":"[PATCH v2 5/7] color: allow \"no-\" for negating attributes","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T17:38:44Z","receivedAt":"2016-06-23T17:38:50Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Using \"no-bold\" rather than \"nobold\" is easier to read and\nmore natural to type (to me, anyway, even though I was the\nperson who introduced \"nobold\" in the first place). It's\neasy to allow both.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n Documentation/config.txt | 2 +-\n color.c                  | 4 +++-\n t/t4026-color.sh         | 4 ++++\n 3 files changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex f8460d4..4b13c90 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -166,7 +166,7 @@ hex, like `#ff0ab3`.\n The accepted attributes are `bold`, `dim`, `ul`, `blink`, and `reverse`.\n The position of any attributes with respect to the colors (before, after,\n or in between), doesn't matter. Specific attributes may be turned off\n-by prefixing them with `no` (e.g., `noreverse`, `noul`, etc).\n+by prefixing them with `no` or `no-` (e.g., `noreverse`, `no-ul`, etc).\n +\n For git's pre-defined color slots, the attributes are meant to be reset\n at the beginning of each item in the colored output. So setting\ndiff --git a/color.c b/color.c\nindex d787dec..a02a935 100644\n--- a/color.c\n+++ b/color.c\n@@ -141,8 +141,10 @@ static int parse_attr(const char *name, size_t len)\n \tint negate = 0;\n \tint i;\n \n-\tif (skip_prefix_mem(name, len, \"no\", &name, &len))\n+\tif (skip_prefix_mem(name, len, \"no\", &name, &len)) {\n+\t\tskip_prefix_mem(name, len, \"-\", &name, &len);\n \t\tnegate = 1;\n+\t}\n \n \tfor (i = 0; i < ARRAY_SIZE(attrs); i++) {\n \t\tif (attrs[i].len == len && !memcmp(attrs[i].name, name, len))\ndiff --git a/t/t4026-color.sh b/t/t4026-color.sh\nindex 2b32c4f..2065752 100755\n--- a/t/t4026-color.sh\n+++ b/t/t4026-color.sh\n@@ -50,6 +50,10 @@ test_expect_success 'attr negation' '\n \tcolor \"nobold nodim noul noblink noreverse\" \"[22;24;25;27m\"\n '\n \n+test_expect_success '\"no-\" variant of negation' '\n+\tcolor \"no-bold no-blink\" \"[22;25m\"\n+'\n+\n test_expect_success 'long color specification' '\n \tcolor \"254 255 bold dim ul blink reverse\" \"[1;2;4;5;7;38;5;254;48;5;255m\"\n '\n-- \n2.9.0.209.g845fbc1\n\n"},{"id":"289979","messageId":"20160623173907.GF15774@sigill.intra.peff.net","threadId":"42696","inReplyTo":"20160623173048.GA19923@sigill.intra.peff.net","subject":"[PATCH v2 6/7] color: support \"italic\" attribute","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T17:39:07Z","receivedAt":"2016-06-23T17:39:16Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We already support bold, underline, and similar attributes.\nLet's add italic to the mix.  According to the Wikipedia\npage on ANSI colors, this attribute is \"not widely\nsupported\", but it does seem to work on my xterm.\n\nWe don't have to bump the maximum color size because we were\nalready over-allocating it (but we do adjust the comment\nappropriately).\n\nRequested-by: Simon Courtois <scourtois@cubyx.fr>\nSigned-off-by: Jeff King <peff@peff.net>\n---\n Documentation/config.txt | 9 +++++----\n color.c                  | 1 +\n color.h                  | 3 ++-\n t/t4026-color.sh         | 5 +++--\n 4 files changed, 11 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 4b13c90..c7818ff 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -163,10 +163,11 @@ Colors may also be given as numbers between 0 and 255; these use ANSI\n your terminal supports it, you may also specify 24-bit RGB values as\n hex, like `#ff0ab3`.\n +\n-The accepted attributes are `bold`, `dim`, `ul`, `blink`, and `reverse`.\n-The position of any attributes with respect to the colors (before, after,\n-or in between), doesn't matter. Specific attributes may be turned off\n-by prefixing them with `no` or `no-` (e.g., `noreverse`, `no-ul`, etc).\n+The accepted attributes are `bold`, `dim`, `ul`, `blink`, `reverse`, and\n+`italic`.  The position of any attributes with respect to the colors\n+(before, after, or in between), doesn't matter. Specific attributes may\n+be turned off by prefixing them with `no` or `no-` (e.g., `noreverse`,\n+`no-ul`, etc).\n +\n For git's pre-defined color slots, the attributes are meant to be reset\n at the beginning of each item in the colored output. So setting\ndiff --git a/color.c b/color.c\nindex a02a935..dcfaea8 100644\n--- a/color.c\n+++ b/color.c\n@@ -133,6 +133,7 @@ static int parse_attr(const char *name, size_t len)\n #define ATTR(x, val, neg) { (x), strlen(x), (val), (neg) }\n \t\tATTR(\"bold\",      1, 22),\n \t\tATTR(\"dim\",       2, 22),\n+\t\tATTR(\"italic\",    3, 23),\n \t\tATTR(\"ul\",        4, 24),\n \t\tATTR(\"blink\",     5, 25),\n \t\tATTR(\"reverse\",   7, 27)\ndiff --git a/color.h b/color.h\nindex e24fa0b..3af01a6 100644\n--- a/color.h\n+++ b/color.h\n@@ -16,7 +16,8 @@ struct strbuf;\n  *\n  * The space for attributes is also slightly overallocated, as\n  * the negation for some attributes is the same (e.g., nobold and nodim).\n- * We also allocate space for 6 attributes (even though we have only 5).\n+ *\n+ * We allocate space for 6 attributes.\n  */\n #define COLOR_MAXLEN 70\n \ndiff --git a/t/t4026-color.sh b/t/t4026-color.sh\nindex 2065752..13690f7 100755\n--- a/t/t4026-color.sh\n+++ b/t/t4026-color.sh\n@@ -60,8 +60,9 @@ test_expect_success 'long color specification' '\n \n test_expect_success 'absurdly long color specification' '\n \tcolor \\\n-\t  \"#ffffff #ffffff bold nobold dim nodim ul noul blink noblink reverse noreverse\" \\\n-\t  \"[1;2;4;5;7;22;24;25;27;38;2;255;255;255;48;2;255;255;255m\"\n+\t  \"#ffffff #ffffff bold nobold dim nodim italic noitalic\n+\t   ul noul blink noblink reverse noreverse\" \\\n+\t  \"[1;2;3;4;5;7;22;23;24;25;27;38;2;255;255;255;48;2;255;255;255m\"\n '\n \n test_expect_success '0-7 are aliases for basic ANSI color names' '\n-- \n2.9.0.209.g845fbc1\n\n"},{"id":"289980","messageId":"20160623174015.GG15774@sigill.intra.peff.net","threadId":"42696","inReplyTo":"20160623173048.GA19923@sigill.intra.peff.net","subject":"[PATCH v2 7/7] color: support strike-through attribute","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T17:40:16Z","receivedAt":"2016-06-23T17:40:23Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is the only remaining attribute that is commonly\nsupported (at least by xterm) that we don't support. Let's\nadd it for completeness.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThis was mostly for fun.  I can't think of a way in which it would be\nuseful, and I'm not sure how compelling completionism is as an argument\nfor inclusion. I'm OK if we drop this one.\n\n Documentation/config.txt | 5 +++--\n color.c                  | 3 ++-\n color.h                  | 4 ++--\n t/t4026-color.sh         | 4 ++--\n 4 files changed, 9 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex c7818ff..b10e49d 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -163,8 +163,9 @@ Colors may also be given as numbers between 0 and 255; these use ANSI\n your terminal supports it, you may also specify 24-bit RGB values as\n hex, like `#ff0ab3`.\n +\n-The accepted attributes are `bold`, `dim`, `ul`, `blink`, `reverse`, and\n-`italic`.  The position of any attributes with respect to the colors\n+The accepted attributes are `bold`, `dim`, `ul`, `blink`, `reverse`,\n+`italic`, and `strike` (for crossed-out or \"strikethrough\" letters).\n+The position of any attributes with respect to the colors\n (before, after, or in between), doesn't matter. Specific attributes may\n be turned off by prefixing them with `no` or `no-` (e.g., `noreverse`,\n `no-ul`, etc).\ndiff --git a/color.c b/color.c\nindex dcfaea8..eb028bd 100644\n--- a/color.c\n+++ b/color.c\n@@ -136,7 +136,8 @@ static int parse_attr(const char *name, size_t len)\n \t\tATTR(\"italic\",    3, 23),\n \t\tATTR(\"ul\",        4, 24),\n \t\tATTR(\"blink\",     5, 25),\n-\t\tATTR(\"reverse\",   7, 27)\n+\t\tATTR(\"reverse\",   7, 27),\n+\t\tATTR(\"strike\",    9, 29)\n #undef ATTR\n \t};\n \tint negate = 0;\ndiff --git a/color.h b/color.h\nindex 3af01a6..6cae166 100644\n--- a/color.h\n+++ b/color.h\n@@ -17,9 +17,9 @@ struct strbuf;\n  * The space for attributes is also slightly overallocated, as\n  * the negation for some attributes is the same (e.g., nobold and nodim).\n  *\n- * We allocate space for 6 attributes.\n+ * We allocate space for 7 attributes.\n  */\n-#define COLOR_MAXLEN 70\n+#define COLOR_MAXLEN 75\n \n /*\n  * IMPORTANT: Due to the way these color codes are emulated on Windows,\ndiff --git a/t/t4026-color.sh b/t/t4026-color.sh\nindex 13690f7..ec78c5e 100755\n--- a/t/t4026-color.sh\n+++ b/t/t4026-color.sh\n@@ -61,8 +61,8 @@ test_expect_success 'long color specification' '\n test_expect_success 'absurdly long color specification' '\n \tcolor \\\n \t  \"#ffffff #ffffff bold nobold dim nodim italic noitalic\n-\t   ul noul blink noblink reverse noreverse\" \\\n-\t  \"[1;2;3;4;5;7;22;23;24;25;27;38;2;255;255;255;48;2;255;255;255m\"\n+\t   ul noul blink noblink reverse noreverse strike nostrike\" \\\n+\t  \"[1;2;3;4;5;7;9;22;23;24;25;27;29;38;2;255;255;255;48;2;255;255;255m\"\n '\n \n test_expect_success '0-7 are aliases for basic ANSI color names' '\n-- \n2.9.0.209.g845fbc1\n"},{"id":"289981","messageId":"xmqqtwgjiwkn.fsf@gitster.mtv.corp.google.com","threadId":"42696","inReplyTo":"20160623173907.GF15774@sigill.intra.peff.net","subject":"Re: [PATCH v2 6/7] color: support \"italic\" attribute","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-23T18:34:00Z","receivedAt":"2016-06-23T18:34:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> We already support bold, underline, and similar attributes.\n> Let's add italic to the mix.  According to the Wikipedia\n> page on ANSI colors, this attribute is \"not widely\n> supported\", but it does seem to work on my xterm.\n> ...\n> @@ -133,6 +133,7 @@ static int parse_attr(const char *name, size_t len)\n>  #define ATTR(x, val, neg) { (x), strlen(x), (val), (neg) }\n\nI see this one was from an earlier reroll that did not use sizeof(x)-1;\neasy to fixup, though ;-)\n\n>  \t\tATTR(\"bold\",      1, 22),\n>  \t\tATTR(\"dim\",       2, 22),\n> +\t\tATTR(\"italic\",    3, 23),\n>  \t\tATTR(\"ul\",        4, 24),\n>  \t\tATTR(\"blink\",     5, 25),\n>  \t\tATTR(\"reverse\",   7, 27)\n> diff --git a/color.h b/color.h\n> index e24fa0b..3af01a6 100644\n> --- a/color.h\n> +++ b/color.h\n> @@ -16,7 +16,8 @@ struct strbuf;\n>   *\n>   * The space for attributes is also slightly overallocated, as\n>   * the negation for some attributes is the same (e.g., nobold and nodim).\n> - * We also allocate space for 6 attributes (even though we have only 5).\n> + *\n> + * We allocate space for 6 attributes.\n>   */\n>  #define COLOR_MAXLEN 70\n>  \n> diff --git a/t/t4026-color.sh b/t/t4026-color.sh\n> index 2065752..13690f7 100755\n> --- a/t/t4026-color.sh\n> +++ b/t/t4026-color.sh\n> @@ -60,8 +60,9 @@ test_expect_success 'long color specification' '\n>  \n>  test_expect_success 'absurdly long color specification' '\n>  \tcolor \\\n> -\t  \"#ffffff #ffffff bold nobold dim nodim ul noul blink noblink reverse noreverse\" \\\n> -\t  \"[1;2;4;5;7;22;24;25;27;38;2;255;255;255;48;2;255;255;255m\"\n> +\t  \"#ffffff #ffffff bold nobold dim nodim italic noitalic\n> +\t   ul noul blink noblink reverse noreverse\" \\\n> +\t  \"[1;2;3;4;5;7;22;23;24;25;27;38;2;255;255;255;48;2;255;255;255m\"\n>  '\n>  \n>  test_expect_success '0-7 are aliases for basic ANSI color names' '\n"},{"id":"289982","messageId":"20160623183603.GA32320@sigill.intra.peff.net","threadId":"42696","inReplyTo":"xmqqtwgjiwkn.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 6/7] color: support \"italic\" attribute","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T18:36:03Z","receivedAt":"2016-06-23T18:36:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 23, 2016 at 11:34:00AM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > We already support bold, underline, and similar attributes.\n> > Let's add italic to the mix.  According to the Wikipedia\n> > page on ANSI colors, this attribute is \"not widely\n> > supported\", but it does seem to work on my xterm.\n> > ...\n> > @@ -133,6 +133,7 @@ static int parse_attr(const char *name, size_t len)\n> >  #define ATTR(x, val, neg) { (x), strlen(x), (val), (neg) }\n> \n> I see this one was from an earlier reroll that did not use sizeof(x)-1;\n> easy to fixup, though ;-)\n\nHeh, whoops, yeah.\n\nGcc was actually happy with the `strlen` there, but I suspect that other\ncompilers might not be.\n\n-Peff\n"},{"id":"289983","messageId":"xmqqpor7iwgo.fsf@gitster.mtv.corp.google.com","threadId":"42696","inReplyTo":"20160623174015.GG15774@sigill.intra.peff.net","subject":"Re: [PATCH v2 7/7] color: support strike-through attribute","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-23T18:36:23Z","receivedAt":"2016-06-23T18:36:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> This is the only remaining attribute that is commonly\n> supported (at least by xterm) that we don't support. Let's\n> add it for completeness.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> This was mostly for fun.  I can't think of a way in which it would be\n> useful, and I'm not sure how compelling completionism is as an argument\n> for inclusion. I'm OK if we drop this one.\n\nIt indeed is fun and it even makes sense in this context:\n\n    $ ./git -c diff.color.old='red strike' show\n\n"},{"id":"289984","messageId":"20160623183907.GA32368@sigill.intra.peff.net","threadId":"42696","inReplyTo":"xmqqpor7iwgo.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 7/7] color: support strike-through attribute","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T18:39:08Z","receivedAt":"2016-06-23T18:39:13Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 23, 2016 at 11:36:23AM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > This is the only remaining attribute that is commonly\n> > supported (at least by xterm) that we don't support. Let's\n> > add it for completeness.\n> >\n> > Signed-off-by: Jeff King <peff@peff.net>\n> > ---\n> > This was mostly for fun.  I can't think of a way in which it would be\n> > useful, and I'm not sure how compelling completionism is as an argument\n> > for inclusion. I'm OK if we drop this one.\n> \n> It indeed is fun and it even makes sense in this context:\n> \n>     $ ./git -c diff.color.old='red strike' show\n\nOoh, I hadn't thought of that. It's a bit noisy for my tastes in a\nline-oriented diff, but with --color-words, it actually helps quite a\nbit (try it on the documentation patch from this series, for example).\n\n-Peff\n"},{"id":"289985","messageId":"xmqqlh1vivp8.fsf@gitster.mtv.corp.google.com","threadId":"42696","inReplyTo":"20160623183907.GA32368@sigill.intra.peff.net","subject":"Re: [PATCH v2 7/7] color: support strike-through attribute","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-23T18:52:51Z","receivedAt":"2016-06-23T18:52:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Thu, Jun 23, 2016 at 11:36:23AM -0700, Junio C Hamano wrote:\n>\n>> Jeff King <peff@peff.net> writes:\n>> \n>> > This is the only remaining attribute that is commonly\n>> > supported (at least by xterm) that we don't support. Let's\n>> > add it for completeness.\n>> >\n>> > Signed-off-by: Jeff King <peff@peff.net>\n>> > ---\n>> > This was mostly for fun.  I can't think of a way in which it would be\n>> > useful, and I'm not sure how compelling completionism is as an argument\n>> > for inclusion. I'm OK if we drop this one.\n>> \n>> It indeed is fun and it even makes sense in this context:\n>> \n>>     $ ./git -c diff.color.old='red strike' show\n>\n> Ooh, I hadn't thought of that. It's a bit noisy for my tastes in a\n> line-oriented diff, but with --color-words, it actually helps quite a\n> bit (try it on the documentation patch from this series, for example).\n\nWhat I usually use is diff.color.old='red reverse' because I cannot\neasily tell between black and dark red in small font on my white\nbackground.  s/reverse/strike/ makes it much less noisy.\n\nWhat is sad for me is that I usually work in GNU screen, displaying\non either xterm or gnome-terminal.  Without screen, strike shows but\ninside it I cannot seem to be able to get strike-thru in effect.\n"},{"id":"289988","messageId":"xmqqh9cjiv72.fsf@gitster.mtv.corp.google.com","threadId":"42696","inReplyTo":"xmqqlh1vivp8.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 7/7] color: support strike-through attribute","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-23T19:03:45Z","receivedAt":"2016-06-23T19:03:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> What is sad for me is that I usually work in GNU screen, displaying\n> on either xterm or gnome-terminal.  Without screen, strike shows but\n> inside it I cannot seem to be able to get strike-thru in effect.\n\n... which unfortunately is expected.\n\nhttps://www.gnu.org/software/screen/manual/screen.html#Control-Sequences\n(look for a string \"Negative Image\" that appears only once)\nindicates that 9/29 are missing.\n\nNot fun X-<.\n"},{"id":"289989","messageId":"20160623190414.GA568@sigill.intra.peff.net","threadId":"42696","inReplyTo":"xmqqlh1vivp8.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 7/7] color: support strike-through attribute","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-23T19:04:14Z","receivedAt":"2016-06-23T19:04:20Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 23, 2016 at 11:52:51AM -0700, Junio C Hamano wrote:\n\n> >> It indeed is fun and it even makes sense in this context:\n> >> \n> >>     $ ./git -c diff.color.old='red strike' show\n> >\n> > Ooh, I hadn't thought of that. It's a bit noisy for my tastes in a\n> > line-oriented diff, but with --color-words, it actually helps quite a\n> > bit (try it on the documentation patch from this series, for example).\n> \n> What I usually use is diff.color.old='red reverse' because I cannot\n> easily tell between black and dark red in small font on my white\n> background.  s/reverse/strike/ makes it much less noisy.\n\nYou may find \"bold red\" a little easier, as it often uses a brighter\nvariant.  We also support 8-bit and 24-bit color these days. So you can\nprobably do something like diff.color.old='#ff0000'. That's all old,\nthough, so I imagine you might have played with it long ago.\n\nI have a black background myself, and save \"reverse\" for diff-highlight.\n\n> What is sad for me is that I usually work in GNU screen, displaying on\n> either xterm or gnome-terminal.  Without screen, strike shows but\n> inside it I cannot seem to be able to get strike-thru in effect.\n\nHmm. I see the same thing screen and with tmux, as well (though I don't\nusually use either myself). I suspect they have to filter ANSI codes\nbecause they're using the codes themselves (so anything that moves the\ncursor is going to be a definite problem), and strike-through probably\njust isn't common enough to have been added to the whitelist.\n\nIt does work with dtach, but that is probably because that program only\ndoes the remote-socket parts of screen/tmux, and so wouldn't need any\nfiltering at all.\n\n-Peff\n"},{"id":"289990","messageId":"xmqqd1n7iuty.fsf@gitster.mtv.corp.google.com","threadId":"42696","inReplyTo":"20160623190414.GA568@sigill.intra.peff.net","subject":"Re: [PATCH v2 7/7] color: support strike-through attribute","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-23T19:11:37Z","receivedAt":"2016-06-23T19:11:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> Hmm. I see the same thing screen and with tmux, as well (though I don't\n> usually use either myself). I suspect they have to filter ANSI codes\n> because they're using the codes themselves (so anything that moves the\n> cursor is going to be a definite problem), and strike-through probably\n> just isn't common enough to have been added to the whitelist.\n\nscreen needs to do a full emulation, not working as a passthru.  It\npretends to be a VT100/ANSI and attempt to show on non-VT100/ANSI\nterminal via termcap/terminfo ;-)\n\nSo it is understandable that the omitted support for less common\nones.\n\nBut we are straying deep into an uninteresting (to the list)\ntangent, so let's stop it here.\n\n"},{"id":"289994","messageId":"xmqq7fdfisrr.fsf@gitster.mtv.corp.google.com","threadId":"42696","inReplyTo":"20160623183907.GA32368@sigill.intra.peff.net","subject":"Re: [PATCH v2 7/7] color: support strike-through attribute","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-23T19:56:08Z","receivedAt":"2016-06-23T19:56:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> ... but with --color-words, it actually helps quite a\n> bit (try it on the documentation patch from this series, for example).\n\nThis gets me back to another tangent, but this time a one that is\nquite a lot more relevant to Git.\n\nThere is this change in \"git show --word-diff\" for the \"italic\"\npatch:\n\n    The accepted attributes are `bold`, `dim`, `ul`, `blink`,\n    {+`reverse`,+} and [-`reverse`.-]{+`italic`.+}\n\nIf we imagine that the pre- and post- image expressed in \"one token\nper line\" format, the text before and after the patch would have\nread like this:\n\n    preimage\t\tpostimage\n    -----------         ------------\n    ...\t\t\t...\n    blink\t\tblink\n    ,\t\t\t,\n    and\t\t\treverse\n    reverse\t\t,\n    .\t\t\tand\n    \t\t\treverse\n                        .\n\nAnd the current output is showing an equivalent of this diff:\n\n\t...\n        blink\n        ,\n       +reverse\n       +,\n        and\n       -reverse\n       -.\n       +italic\n       +.\n\nBut if we were doing line-level diff for the above two, I would\nthink this is much easier to read:\n\n\t...\n        blink\n        ,\n       -and\n        reverse\n       +,\n       +and\n       +italic\n       +.\n\nThat would give us a word-diff more like this, I would imagine,\n\n    The accepted attributes are `bold`, `dim`, `ul`, `blink`,\n    [-and-] reverse[-,-] {+and `italic`}.\n\nand that would be much easier to read than the current --word-diff\noutput.\n"}]}