# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 2022-10-27 21:34:02 # Node ID 9f3d34049923e92f9fe933af3ef238b399e77f7a # Parent 9fc0d244a753d9309cc9e9da9550086041d3dea8 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) )