changeset 43664:bde66eb4051d

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.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Wed, 30 Oct 2019 19:19:57 -0400
parents 1d29da62af76
children f37da59a36d9
files hgext/histedit.py
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Wed Oct 30 19:34:57 2019 -0400
+++ b/hgext/histedit.py	Wed Oct 30 19:19:57 2019 -0400
@@ -1499,9 +1499,12 @@
                 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,
@@ -1510,7 +1513,17 @@
                     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):