This is an archive of the discontinued Mercurial Phabricator instance.

crecord: new keys g & G to navigate to the top and bottom respectively
ClosedPublic

Authored by arun on Apr 2 2019, 1:30 AM.

Details

Summary

This patch introduces two new keys 'g' and 'G' that helps to navigate to the
top and bottom of the file/hunk/line respectively. This is inline with the shortcuts
used in man, less, more and such tools that makes it convenient to navigate
swiftly.

'g' or HOME navigates to the top most file in the ncurses window.

'G' or END navigates to the bottom most file/hunk/line depending on the whether
the fold is active or not.

If the bottom most file is folded, it navigates to that file and stops there.
If the bottom most file is unfolded, it navigates to the bottom most hunk in
that file and stops there. If the bottom most hunk is unfolded, it navigates to
the bottom most line in that hunk.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

arun created this revision.Apr 2 2019, 1:30 AM
arun edited the summary of this revision. (Show Details)Apr 2 2019, 1:35 PM
arun retitled this revision from crecord: new keys g & G to navigate to the top and bottom hunks respectively to crecord: new keys g & G to navigate to the top and bottom respectively.
arun updated this revision to Diff 14620.
arun updated this revision to Diff 14621.Apr 2 2019, 1:38 PM
JordiGH added a subscriber: JordiGH.Apr 2 2019, 1:38 PM
JordiGH added inline comments.
mercurial/crecord.py
1471

We should find a better way to phrase this, since it's not about hunk. Maybe just "first line" and "last line".

1772

It would be nice to map these to Home and End (which by the way, also map on less).

arun edited the summary of this revision. (Show Details)Apr 2 2019, 1:53 PM
arun updated this revision to Diff 14623.
arun marked an inline comment as done.Apr 2 2019, 1:58 PM
arun added inline comments.
mercurial/crecord.py
1471

Amended the patch. Simply top/bottom seems good as well. Can you have another look?

JordiGH accepted this revision.Apr 5 2019, 10:56 AM
pulkit accepted this revision.Apr 5 2019, 11:01 AM

Amending this diff to make test-check-code.t happy which complains about lines longer than 80.

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -1528,10 +1528,10 @@ the following are valid keystrokes:
         Handle 'G' to navigate to the bottom most file/hunk/line depending
         on the whether the fold is active or not.
 
-        If the bottom most file is folded, it navigates to that file and stops there.
-        If the bottom most file is unfolded, it navigates to the bottom most hunk in
-        that file and stops there. If the bottom most hunk is unfolded, it navigates to
-        the bottom most line in that hunk.
+        If the bottom most file is folded, it navigates to that file and
+        stops there. If the bottom most file is unfolded, it navigates to
+        the bottom most hunk in that file and stops there. If the bottom most
+        hunk is unfolded, it navigates to the bottom most line in that hunk.
         """
         currentitem = self.currentselecteditem
         nextitem = currentitem.nextitem()
This revision was automatically updated to reflect the committed changes.