[PATCH] chistedit: use default curses colours

Jordi GutiƩrrez Hermoso jordigh at octave.org
Wed Apr 3 23:13:16 EDT 2019


# HG changeset patch
# User Jordi GutiƩrrez Hermoso <jordigh at octave.org>
# Date 1554347266 14400
#      Wed Apr 03 23:07:46 2019 -0400
# Node ID 263cec9c08fc1b517847fe53f27b47978be127f4
# Parent  4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c
chistedit: use default curses colours

Terminals will define default colours (for example, white text on
black background), but curses doesn't obey those default colours
unless told to do so.

Calling `curses.use_default_colors` makes curses obey the default
terminal colours. One of the most obvious effects is that this allows
transparency on terminals that support it.

This also brings chistedit closer in appearance to crecord, which also
uses default colours.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1238,6 +1238,8 @@ def patchcontents(state):
     return displayer.hunk[rule.ctx.rev()].splitlines()
 
 def _chisteditmain(repo, rules, stdscr):
+    curses.use_default_colors()
+
     # initialize color pattern
     curses.init_pair(COLOR_HELP, curses.COLOR_WHITE, curses.COLOR_BLUE)
     curses.init_pair(COLOR_SELECTED, curses.COLOR_BLACK, curses.COLOR_WHITE)


More information about the Mercurial-devel mailing list