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.
--- 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)
)