Patchwork [STABLE] crecord: fix help bar display issue(issue5063)

login
register
mail settings
Submitter Laurent Charignon
Date Jan. 25, 2016, 7:40 p.m.
Message ID <18c911fcf8b1d1bd4b65.1453750816@dev5073.prn1.facebook.com>
Download mbox | patch
Permalink /patch/12884/
State Accepted
Headers show

Comments

Laurent Charignon - Jan. 25, 2016, 7:40 p.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1453750622 28800
#      Mon Jan 25 11:37:02 2016 -0800
# Branch stable
# Node ID 18c911fcf8b1d1bd4b657df5e7b703f3e7746520
# Parent  4c6053a6b17d682b34fb88bbeb5e94ed9085d900
crecord: fix help bar display issue(issue5063)

Before this patch, the help bar in crecord wouldn't be printed correctly when
the terminal window didn't have enough column to display it. This patch adds
logic to make sure that the help bar message is always displayed. We use an
ellipsis when it is not possible to display the complete message.
Matt Mackall - Jan. 25, 2016, 11 p.m.
On Mon, 2016-01-25 at 11:40 -0800, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1453750622 28800
> #      Mon Jan 25 11:37:02 2016 -0800
> # Branch stable
> # Node ID 18c911fcf8b1d1bd4b657df5e7b703f3e7746520
> # Parent  4c6053a6b17d682b34fb88bbeb5e94ed9085d900
> crecord: fix help bar display issue(issue5063)

Queued for stable, thanks.

-- 
Mathematics is the supreme nostalgia of our time.

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -1010,13 +1010,16 @@ 
                             pairname='legend')
                 self.statuswin.refresh()
                 return
+            line1 = ("SELECT CHUNKS: (j/k/up/dn/pgup/pgdn) move cursor; "
+                   "(space/A) toggle hunk/all; (e)dit hunk;")
+            line2 = (" (f)old/unfold; (c)onfirm applied; (q)uit; (?) help "
+                   "| [X]=hunk applied **=folded, toggle [a]mend mode")
+
             printstring(self.statuswin,
-                        "SELECT CHUNKS: (j/k/up/dn/pgup/pgdn) move cursor; "
-                        "(space/A) toggle hunk/all; (e)dit hunk;",
+                        util.ellipsis(line1, self.xscreensize - 1),
                         pairname="legend")
             printstring(self.statuswin,
-                        " (f)old/unfold; (c)onfirm applied; (q)uit; (?) help "
-                        "| [X]=hunk applied **=folded, toggle [a]mend mode",
+                        util.ellipsis(line2, self.xscreensize - 1),
                         pairname="legend")
         except curses.error:
             pass