changeset 29957:7d053ba73178

crecord: add an event that scrolls the selected line to the top of the screen Using ctrl-l for this purpose seems to be a fairly widely used practice, presumably following emacs. This doesn't scroll the selected line all the way to the top of the window, instead it leaves a 3 line buffer for context. Use curses.unctrl() to resolve keypressed to '^L' to avoid hard-coding hexadecimal key codes.
author Nathan Goldbaum <ngoldbau@illinois.edu>
date Tue, 20 Sep 2016 10:03:50 -0500
parents fa5e4f58dfbc
children 37a36c05dcc3
files mercurial/crecord.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/crecord.py	Tue May 03 14:24:00 2016 +0900
+++ b/mercurial/crecord.py	Tue Sep 20 10:03:50 2016 -0500
@@ -1338,6 +1338,7 @@
  shift-left-arrow   [H] : go to parent header / fold selected header
                       f : fold / unfold item, hiding/revealing its children
                       F : fold / unfold parent item and all of its ancestors
+                 ctrl-l : scroll the selected line to the top of the screen
                       m : edit / resume editing the commit message
                       e : edit the currently selected hunk
                       a : toggle amend mode, only with commit -i
@@ -1582,6 +1583,9 @@
             self.helpwindow()
             self.stdscr.clear()
             self.stdscr.refresh()
+        elif curses.unctrl(keypressed) in ["^L"]:
+            # scroll the current line to the top of the screen
+            self.scrolllines(self.selecteditemstartline)
 
     def main(self, stdscr):
         """