D6178: crecord: new keys g & G to navigate to the top and bottom respectively
This revision was automatically updated to reflect the committed changes. Closed by commit rHG80103ed2e8ee: crecord: new keys g G to navigate to the top and bottom respectively (authored by carun, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D6178?vs=14623=14681#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6178?vs=14623=14681 REVISION DETAIL https://phab.mercurial-scm.org/D6178 AFFECTED FILES mercurial/crecord.py CHANGE DETAILS diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1467,6 +1467,8 @@ pgup/pgdn [K/J] : go to previous/next item of same type right/left-arrow [l/h] : go to child item / parent item shift-left-arrow [H] : go to parent header / fold selected header + g : go to the top + G : go to the bottom 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 @@ -1505,6 +1507,45 @@ self.stdscr.refresh() self.stdscr.keypad(1) # allow arrow-keys to continue to function +def handlefirstlineevent(self): +""" +Handle 'g' to navigate to the top most file in the ncurses window. +""" +self.currentselecteditem = self.headerlist[0] +currentitem = self.currentselecteditem +# select the parent item recursively until we're at a header +while True: +nextitem = currentitem.parentitem() +if nextitem is None: +break +else: +currentitem = nextitem + +self.currentselecteditem = currentitem + +def handlelastlineevent(self): +""" +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. +""" +currentitem = self.currentselecteditem +nextitem = currentitem.nextitem() +# select the child item recursively until we're at a footer +while nextitem is not None: +nextitem = currentitem.nextitem() +if nextitem is None: +break +else: +currentitem = nextitem + +self.currentselecteditem = currentitem +self.recenterdisplayedarea() + def confirmationwindow(self, windowtext): "display an informational window, then wait for and return a keypress." @@ -1725,6 +1766,10 @@ self.togglefolded(foldparent=True) elif keypressed in ["m"]: self.commitMessageWindow() +elif keypressed in ["g", "KEY_HOME"]: +self.handlefirstlineevent() +elif keypressed in ["G", "KEY_END"]: +self.handlelastlineevent() elif keypressed in ["?"]: self.helpwindow() self.stdscr.clear() To: arun, #hg-reviewers, JordiGH, pulkit Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6178: crecord: new keys g & G to navigate to the top and bottom respectively
pulkit added a comment. 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() REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6178 To: arun, #hg-reviewers, JordiGH, pulkit Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6178: crecord: new keys g & G to navigate to the top and bottom respectively
arun marked an inline comment as done. arun added inline comments. INLINE COMMENTS > JordiGH wrote in 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". Amended the patch. Simply top/bottom seems good as well. Can you have another look? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6178 To: arun, #hg-reviewers Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6178: crecord: new keys g & G to navigate to the top and bottom respectively
arun updated this revision to Diff 14623. arun edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6178?vs=14621=14623 REVISION DETAIL https://phab.mercurial-scm.org/D6178 AFFECTED FILES mercurial/crecord.py CHANGE DETAILS diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1467,6 +1467,8 @@ pgup/pgdn [K/J] : go to previous/next item of same type right/left-arrow [l/h] : go to child item / parent item shift-left-arrow [H] : go to parent header / fold selected header + g : go to the top + G : go to the bottom 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 @@ -1505,6 +1507,45 @@ self.stdscr.refresh() self.stdscr.keypad(1) # allow arrow-keys to continue to function +def handlefirstlineevent(self): +""" +Handle 'g' to navigate to the top most file in the ncurses window. +""" +self.currentselecteditem = self.headerlist[0] +currentitem = self.currentselecteditem +# select the parent item recursively until we're at a header +while True: +nextitem = currentitem.parentitem() +if nextitem is None: +break +else: +currentitem = nextitem + +self.currentselecteditem = currentitem + +def handlelastlineevent(self): +""" +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. +""" +currentitem = self.currentselecteditem +nextitem = currentitem.nextitem() +# select the child item recursively until we're at a footer +while nextitem is not None: +nextitem = currentitem.nextitem() +if nextitem is None: +break +else: +currentitem = nextitem + +self.currentselecteditem = currentitem +self.recenterdisplayedarea() + def confirmationwindow(self, windowtext): "display an informational window, then wait for and return a keypress." @@ -1725,6 +1766,10 @@ self.togglefolded(foldparent=True) elif keypressed in ["m"]: self.commitMessageWindow() +elif keypressed in ["g", "KEY_HOME"]: +self.handlefirstlineevent() +elif keypressed in ["G", "KEY_END"]: +self.handlelastlineevent() elif keypressed in ["?"]: self.helpwindow() self.stdscr.clear() To: arun, #hg-reviewers Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6178: crecord: new keys g & G to navigate to the top and bottom respectively
JordiGH added inline comments. INLINE COMMENTS > crecord.py:1471 > + g : go to the first hunk line > + G : go to the last hunk line >f : fold / unfold item, hiding/revealing its children We should find a better way to phrase this, since it's not about hunk. Maybe just "first line" and "last line". > crecord.py:1766 > +elif keypressed in ["G"]: > +self.handlelastlineevent() > elif keypressed in ["?"]: It would be nice to map these to Home and End (which by the way, also map on `less`). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6178 To: arun, #hg-reviewers Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6178: crecord: new keys g & G to navigate to the top and bottom respectively
arun updated this revision to Diff 14621. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6178?vs=14620=14621 REVISION DETAIL https://phab.mercurial-scm.org/D6178 AFFECTED FILES mercurial/crecord.py CHANGE DETAILS diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1467,6 +1467,8 @@ pgup/pgdn [K/J] : go to previous/next item of same type right/left-arrow [l/h] : go to child item / parent item shift-left-arrow [H] : go to parent header / fold selected header + g : go to the top + G : go to the bottom 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 @@ -1505,6 +1507,45 @@ self.stdscr.refresh() self.stdscr.keypad(1) # allow arrow-keys to continue to function +def handlefirstlineevent(self): +""" +Handle 'g' to navigate to the top most file in the ncurses window. +""" +self.currentselecteditem = self.headerlist[0] +currentitem = self.currentselecteditem +# select the parent item recursively until we're at a header +while True: +nextitem = currentitem.parentitem() +if nextitem is None: +break +else: +currentitem = nextitem + +self.currentselecteditem = currentitem + +def handlelastlineevent(self): +""" +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. +""" +currentitem = self.currentselecteditem +nextitem = currentitem.nextitem() +# select the child item recursively until we're at a footer +while nextitem is not None: +nextitem = currentitem.nextitem() +if nextitem is None: +break +else: +currentitem = nextitem + +self.currentselecteditem = currentitem +self.recenterdisplayedarea() + def confirmationwindow(self, windowtext): "display an informational window, then wait for and return a keypress." @@ -1725,6 +1766,10 @@ self.togglefolded(foldparent=True) elif keypressed in ["m"]: self.commitMessageWindow() +elif keypressed in ["g"]: +self.handlefirstlineevent() +elif keypressed in ["G"]: +self.handlelastlineevent() elif keypressed in ["?"]: self.helpwindow() self.stdscr.clear() To: arun, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6178: crecord: new keys g & G to navigate to the top and bottom respectively
arun updated this revision to Diff 14620. arun edited the summary of this revision. 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". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6178?vs=14615=14620 REVISION DETAIL https://phab.mercurial-scm.org/D6178 AFFECTED FILES mercurial/crecord.py CHANGE DETAILS diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1467,6 +1467,8 @@ pgup/pgdn [K/J] : go to previous/next item of same type right/left-arrow [l/h] : go to child item / parent item shift-left-arrow [H] : go to parent header / fold selected header + g : go to the first hunk line + G : go to the last hunk line 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 @@ -1505,6 +1507,45 @@ self.stdscr.refresh() self.stdscr.keypad(1) # allow arrow-keys to continue to function +def handlefirstlineevent(self): +""" +Handle 'g' to navigate to the top most file in the ncurses window. +""" +self.currentselecteditem = self.headerlist[0] +currentitem = self.currentselecteditem +# select the parent item recursively until we're at a header +while True: +nextitem = currentitem.parentitem() +if nextitem is None: +break +else: +currentitem = nextitem + +self.currentselecteditem = currentitem + +def handlelastlineevent(self): +""" +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. +""" +currentitem = self.currentselecteditem +nextitem = currentitem.nextitem() +# select the child item recursively until we're at a footer +while nextitem is not None: +nextitem = currentitem.nextitem() +if nextitem is None: +break +else: +currentitem = nextitem + +self.currentselecteditem = currentitem +self.recenterdisplayedarea() + def confirmationwindow(self, windowtext): "display an informational window, then wait for and return a keypress." @@ -1725,6 +1766,10 @@ self.togglefolded(foldparent=True) elif keypressed in ["m"]: self.commitMessageWindow() +elif keypressed in ["g"]: +self.handlefirstlineevent() +elif keypressed in ["G"]: +self.handlelastlineevent() elif keypressed in ["?"]: self.helpwindow() self.stdscr.clear() To: arun, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel