Patchwork [4,of,5] crecord: change help text for the space key dynamically

login
register
mail settings
Submitter Jun Wu
Date Nov. 28, 2016, 11:52 p.m.
Message ID <799c420180287cbe9bb2.1480377128@x1c>
Download mbox | patch
Permalink /patch/17773/
State Accepted
Headers show

Comments

Jun Wu - Nov. 28, 2016, 11:52 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1480376249 0
#      Mon Nov 28 23:37:29 2016 +0000
# Node ID 799c420180287cbe9bb2626c5c6286444ba695ab
# Parent  527aa5f0098020651d0eb437538ed429380cd1ce
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 799c42018028
crecord: change help text for the space key dynamically

A follow-up of the previous patch, to make the text simple and clear about
whether it's to "select" or "deselect".

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -949,4 +949,5 @@  class curseschunkselector(object):
     def _getstatuslinesegments(self):
         """-> [str]. return segments"""
+        selected = self.currentselecteditem.applied
         segments = [
             _('Select hunks to record'),
@@ -956,5 +957,5 @@  class curseschunkselector(object):
             _('q: abort'),
             _('arrow keys: move/expand/collapse'),
-            _('space: select'),
+            _('space: deselect') if selected else _('space: select'),
             _('?: help'),
         ]