changeset 50302:22d7cb8174ef stable

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.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Thu, 27 Oct 2022 17:34:02 -0400
parents 9fc0d244a753
children 0d3690f8ce2a
files hgext/histedit.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Wed Mar 15 05:49:56 2023 +0100
+++ b/hgext/histedit.py	Thu Oct 27 17:34:02 2022 -0400
@@ -1427,11 +1427,11 @@
         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)
                     )