# HG changeset patch
# User Jordi Gutiérrez Hermoso <jord...@octave.org>
# Date 1572477597 14400
#      Wed Oct 30 19:19:57 2019 -0400
# Node ID edc9a7a388b6f939c9464e426fee3de31d005ca7
# Parent  b2db799c5a1d3a66961246f9c7598db3dc63c4de
histedit: render a rolled up description using the proper roll colours

Users have rightfully complained that the old behaviour of completely
removing the description of a rolled commit makes it difficult to
remember what was in that commit. Instead, we now render the removed
description in red.

I couldn't think of a simpler way to do this. You can't just combine
existing curses colours into new effects; only secondary effects like
bold or underline can be logically OR'ed to generate a combined text
effect. It seems easier to just redundantly keep track of what the
roll colour should be.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1497,9 +1497,12 @@ pgup/K: move patch up, pgdn/J: move patc
                 rulesscr.addstr(y, 0, b" ", curses.color_pair(COLOR_WARN))
             else:
                 rulesscr.addstr(y, 0, b" ", curses.COLOR_BLACK)
+
             if y + start == selected:
+                rollcolor = COLOR_ROLL_SELECTED
                 addln(rulesscr, y, 2, rule, curses.color_pair(COLOR_SELECTED))
             elif y + start == pos:
+                rollcolor = COLOR_ROLL_CURRENT
                 addln(
                     rulesscr,
                     y,
@@ -1508,7 +1511,13 @@ pgup/K: move patch up, pgdn/J: move patc
                     curses.color_pair(COLOR_CURRENT) | curses.A_BOLD,
                 )
             else:
+                rollcolor = COLOR_ROLL
                 addln(rulesscr, y, 2, rule)
+
+            if rule.action == b'roll':
+                rulesscr.addstr(y, 2 + len(rule.prefix), rule.desc,
+                                curses.color_pair(rollcolor))
+
         rulesscr.noutrefresh()
 
     def renderstring(win, state, output, diffcolors=False):
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to