Patchwork chistedit: use magenta for current line as in crecord (issue6071)

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date Feb. 13, 2019, 10 p.m.
Message ID <e31eb021571e1a6a63aa.1550095230@chloe>
Download mbox | patch
Permalink /patch/38734/
State Accepted
Headers show

Comments

Jordi Gutiérrez Hermoso - Feb. 13, 2019, 10 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1550095104 18000
#      Wed Feb 13 16:58:24 2019 -0500
# Node ID e31eb021571e1a6a63aab8090819184576236c58
# Parent  5d383d9636d0b81b416398913b32b8c715e98db5
chistedit: use magenta for current line as in crecord (issue6071)

It was inconsistent in the UI to have different way to show the
current line.
via Mercurial-devel - Feb. 14, 2019, 10:42 p.m.
On Wed, Feb 13, 2019 at 2:02 PM Jordi Gutiérrez Hermoso <jordigh@octave.org>
wrote:

> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1550095104 18000
> #      Wed Feb 13 16:58:24 2019 -0500
> # Node ID e31eb021571e1a6a63aab8090819184576236c58
> # Parent  5d383d9636d0b81b416398913b32b8c715e98db5
> chistedit: use magenta for current line as in crecord (issue6071)
>

That looks much clearer. We have had a few users complain about this
internally after rolling out chistedit a few days ago. Queued, thanks.
via Mercurial-devel - Feb. 14, 2019, 10:44 p.m.
test-check-code.t was unhappy with the line length, so I added break before
"curses.color_pair()".

On Thu, Feb 14, 2019 at 2:42 PM Martin von Zweigbergk <martinvonz@google.com>
wrote:

>
> On Wed, Feb 13, 2019 at 2:02 PM Jordi Gutiérrez Hermoso <
> jordigh@octave.org> wrote:
>
>> # HG changeset patch
>> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
>> # Date 1550095104 18000
>> #      Wed Feb 13 16:58:24 2019 -0500
>> # Node ID e31eb021571e1a6a63aab8090819184576236c58
>> # Parent  5d383d9636d0b81b416398913b32b8c715e98db5
>> chistedit: use magenta for current line as in crecord (issue6071)
>>
>
> That looks much clearer. We have had a few users complain about this
> internally after rolling out chistedit a few days ago. Queued, thanks.
>

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -957,7 +957,7 @@  ACTION_LABELS = {
     'roll': '^roll',
 }
 
-COLOR_HELP, COLOR_SELECTED, COLOR_OK, COLOR_WARN  = 1, 2, 3, 4
+COLOR_HELP, COLOR_SELECTED, COLOR_OK, COLOR_WARN, COLOR_CURRENT  = 1, 2, 3, 4, 5
 
 E_QUIT, E_HISTEDIT = 1, 2
 E_PAGEDOWN, E_PAGEUP, E_LINEUP, E_LINEDOWN, E_RESIZE = 3, 4, 5, 6, 7
@@ -1237,6 +1237,7 @@  def _chisteditmain(repo, rules, stdscr):
     curses.init_pair(COLOR_SELECTED, curses.COLOR_BLACK, curses.COLOR_WHITE)
     curses.init_pair(COLOR_WARN, curses.COLOR_BLACK, curses.COLOR_YELLOW)
     curses.init_pair(COLOR_OK, curses.COLOR_BLACK, curses.COLOR_GREEN)
+    curses.init_pair(COLOR_CURRENT, curses.COLOR_WHITE, curses.COLOR_MAGENTA)
 
     # don't display the cursor
     try:
@@ -1327,7 +1328,7 @@  pgup/K: move patch up, pgdn/J: move patc
             if y + start == selected:
                 addln(rulesscr, y, 2, rule, curses.color_pair(COLOR_SELECTED))
             elif y + start == pos:
-                addln(rulesscr, y, 2, rule, curses.A_BOLD)
+                addln(rulesscr, y, 2, rule, curses.color_pair(COLOR_CURRENT) | curses.A_BOLD)
             else:
                 addln(rulesscr, y, 2, rule)
         rulesscr.noutrefresh()