edgimar committed d4a4f73

- add shift-left (shift-h) event which either moves to the header of the
selected node, or folds a selected header.

Comments (0)

Files changed (1)


         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
     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
             elif keyPressed in ["h", "KEY_LEFT"]:
+            elif keyPressed in ["H", "KEY_SLEFT"]:
+                self.leftArrowShiftEvent()
             elif keyPressed in ["q"]:
                 raise util.Abort(_('user quit'))
             elif keyPressed in ["c"]:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.