Patch LGTM

> On Mar 15, 2023, at 14:55, Jordi Gutiérrez Hermoso <jord...@octave.org> wrote:
> 
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jord...@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@lists.mercurial-scm.org
> https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel

_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@lists.mercurial-scm.org
https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to