[PATCH] histedit: fix diff colors
Augie Fackler
raf at durin42.com
Tue Oct 25 16:58:11 UTC 2022
This patch looks obviously-correct to me and should be pushed. What’s going on here is that byte_string[index] returns an int, not a byte, so the .startswith() is a strict correctness improvement.
Thanks!
> On Oct 24, 2022, at 5:05 PM, Jordi Gutiérrez Hermoso <jordigh at octave.org> wrote:
>
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh at octave.org>
> # Date 1666645456 14400
> # Mon Oct 24 17:04:16 2022 -0400
> # Node ID 5287d8898362935f06b482b236ca6ba948c6850d
> # Parent f68d285158b21d7d13c2a70c8db85e83a83ee392
> histedit: fix diff colors
>
> I don't know what was up here, but seems like checking for the first
> byte isn't the same thing as "startswith", so the colours in chistedit
> diffs were broken.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -1428,11 +1428,11 @@ pgup/K: move patch up, pgdn/J: move patc
> for y in range(0, length):
> line = output[y]
> if diffcolors:
> - if line and line[0] == b'+':
> + if line and line.startswith(b'+'):
> win.addstr(
> y, 0, line, curses.color_pair(COLOR_DIFF_ADD_LINE)
> )
> - elif line and line[0] == b'-':
> + elif line and line.startswith(b'-'):
> win.addstr(
> y, 0, line, curses.color_pair(COLOR_DIFF_DEL_LINE)
> )
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at lists.mercurial-scm.org
> https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list