[PATCH] histedit: fix diff colors
Augie Fackler
raf at durin42.com
Sun Mar 19 19:06:13 UTC 2023
Patch LGTM
> On Mar 15, 2023, at 14:55, Jordi Gutiérrez Hermoso <jordigh at octave.org> wrote:
>
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh at octave.org>
> # Date 1666906442 14400
> # Thu Oct 27 17:34:02 2022 -0400
> # Node ID 28cad0a7eb26a3bb0edd4623d1ec1c9169eb49e2
> # Parent dd42156b6441f6b8356100b4228fa16fbf95f669
> histedit: fix diff colors
>
> The problem here is that indexing a bytestring gives you integers, not
> chars, so the comparison to b'+' ends up being wrong.
>
> We don't really have a way to test curses output, so no tests to
> verify the correctness of this behaviour.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -1427,11 +1427,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.startswith(b'+'):
> win.addstr(
> y, 0, line, curses.color_pair(COLOR_DIFF_ADD_LINE)
> )
> - elif line and line[0] == b'-':
> + elif 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