git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH] diff.c: pass sign_index to emit_line_ws_markup
Date: Thu, 23 Aug 2018 16:26:14 +0200 (DST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1808231625510.73@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20180822222548.236699-1-sbeller@google.com>

Hi Stefan,

On Wed, 22 Aug 2018, Stefan Beller wrote:

> Instead of passing the sign directly to emit_line_ws_markup, pass only the
> index to lookup the sign in diff_options->output_indicators.
> 
> Signed-off-by: Stefan Beller <sbeller@google.com>

Looks good to me!

> ---
>  diff.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
>  
> So something like this on top of sb/range-diff-colors ?  If a resend is
> needed I'll squash this in (or carry it as a cleanup patch early in the
> series), otherwise we could put this on top.

I'd leave this as a separate commit.

Ciao,
Dscho

> 
> Thanks,
> Stefan
>  
> 
> diff --git a/diff.c b/diff.c
> index 03486c35b75..17e33d506a1 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -1199,10 +1199,11 @@ static void dim_moved_lines(struct diff_options *o)
>  static void emit_line_ws_markup(struct diff_options *o,
>  				const char *set_sign, const char *set,
>  				const char *reset,
> -				char sign, const char *line, int len,
> +				int sign_index, const char *line, int len,
>  				unsigned ws_rule, int blank_at_eof)
>  {
>  	const char *ws = NULL;
> +	int sign = o->output_indicators[sign_index];
>  
>  	if (o->ws_error_highlight & ws_rule) {
>  		ws = diff_get_color_opt(o, DIFF_WHITESPACE);
> @@ -1282,8 +1283,7 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
>  				set = diff_get_color_opt(o, DIFF_FILE_OLD);
>  		}
>  		emit_line_ws_markup(o, set_sign, set, reset,
> -				    o->output_indicators[OUTPUT_INDICATOR_CONTEXT],
> -				    line, len,
> +				    OUTPUT_INDICATOR_CONTEXT, line, len,
>  				    flags & (DIFF_SYMBOL_CONTENT_WS_MASK), 0);
>  		break;
>  	case DIFF_SYMBOL_PLUS:
> @@ -1327,8 +1327,7 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
>  			flags &= ~DIFF_SYMBOL_CONTENT_WS_MASK;
>  		}
>  		emit_line_ws_markup(o, set_sign, set, reset,
> -				    o->output_indicators[OUTPUT_INDICATOR_NEW],
> -				    line, len,
> +				    OUTPUT_INDICATOR_NEW, line, len,
>  				    flags & DIFF_SYMBOL_CONTENT_WS_MASK,
>  				    flags & DIFF_SYMBOL_CONTENT_BLANK_LINE_EOF);
>  		break;
> @@ -1372,8 +1371,7 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
>  				set = diff_get_color_opt(o, DIFF_CONTEXT_DIM);
>  		}
>  		emit_line_ws_markup(o, set_sign, set, reset,
> -				    o->output_indicators[OUTPUT_INDICATOR_OLD],
> -				    line, len,
> +				    OUTPUT_INDICATOR_OLD, line, len,
>  				    flags & DIFF_SYMBOL_CONTENT_WS_MASK, 0);
>  		break;
>  	case DIFF_SYMBOL_WORDS_PORCELAIN:
> -- 
> 2.18.0.265.g16de1b435c9.dirty
> 
> 

  reply	other threads:[~2018-08-23 14:26 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10 22:49 [PATCH 0/4] Better colors in range-diff! Stefan Beller
2018-08-10 22:49 ` [PATCH 1/4] diff.c: emit_line_0 to take string instead of first sign Stefan Beller
2018-08-13 11:42   ` Johannes Schindelin
2018-08-13 18:19     ` Stefan Beller
2018-08-10 22:49 ` [PATCH 2/4] diff.c: add --output-indicator-{new, old, context} Stefan Beller
2018-08-13 11:47   ` Johannes Schindelin
2018-08-13 18:23     ` Stefan Beller
2018-08-10 22:49 ` [PATCH 3/4] range-diff: make use of different output indicators Stefan Beller
2018-08-13 11:51   ` Johannes Schindelin
2018-08-13 18:24     ` Stefan Beller
2018-08-10 22:49 ` [PATCH 4/4] range-diff: indent special lines as context Stefan Beller
2018-08-13 11:54   ` Johannes Schindelin
2018-08-13 18:36     ` Stefan Beller
2018-08-14 18:54       ` Johannes Schindelin
2018-08-14 19:05         ` Stefan Beller
2018-08-16  8:22           ` Johannes Schindelin
2018-08-17 20:43             ` [PATCH 0/3] Better colors in range-diff Stefan Beller
2018-08-17 20:43               ` [PATCH 1/3] diff.c: add --output-indicator-{new, old, context} Stefan Beller
2018-08-20 19:31                 ` Johannes Schindelin
2018-08-20 19:39                   ` Stefan Beller
2018-08-21 16:13                     ` Johannes Schindelin
2018-08-22 22:25                       ` [PATCH] diff.c: pass sign_index to emit_line_ws_markup Stefan Beller
2018-08-23 14:26                         ` Johannes Schindelin [this message]
2018-08-17 20:43               ` [PATCH 2/3] range-diff: make use of different output indicators Stefan Beller
2018-08-17 20:43               ` [PATCH 3/3] range-diff: indent special lines as context Stefan Beller
2018-08-17 22:04               ` [PATCH 0/3] Better colors in range-diff Junio C Hamano
2018-08-17 22:09                 ` Stefan Beller
  -- strict thread matches above, loose matches on Subject: below --
2018-10-10 23:24 [PATCH] diff.c: pass sign_index to emit_line_ws_markup Stefan Beller
2018-10-12  9:37 ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nycvar.QRO.7.76.6.1808231625510.73@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).