# HG changeset patch # User Mark Edgington # Date 1296727855 -3600 # Node ID d4a4f739a03934d849b10698d4ce05807650d1d9 # Parent 4af10dce21e0016951e109104b6680c6fb3ef7f1 - add shift-left (shift-h) event which either moves to the header of the selected node, or folds a selected header. diff --git a/crecord/chunk_selector.py b/crecord/chunk_selector.py --- a/crecord/chunk_selector.py +++ b/crecord/chunk_selector.py @@ -251,6 +251,29 @@ self.currentSelectedItem = nextItem + def leftArrowShiftEvent(self): + """ + Select the header of the current item (or fold current item if the + current item is already a header). + + """ + currentItem = self.currentSelectedItem + + if isinstance(currentItem, header): + if not currentItem.folded: + self.toggleFolded(item=currentItem) + return + + # 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 updateScroll(self): "Scroll the screen to fully show the currently-selected" selStart = self.selectedItemStartLine @@ -871,6 +894,7 @@ Up/Down-arrow [k/j] : go to previous/next unfolded item 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 f : fold / unfold item, hiding/revealing its children F : fold / unfold parent item and all of its ancestors m : edit / resume editing the commit message @@ -1017,6 +1041,8 @@ self.rightArrowEvent() elif keyPressed in ["h", "KEY_LEFT"]: self.leftArrowEvent() + elif keyPressed in ["H", "KEY_SLEFT"]: + self.leftArrowShiftEvent() elif keyPressed in ["q"]: raise util.Abort(_('user quit')) elif keyPressed in ["c"]: