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.
--- 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):
"""