Mercurial > hg > crecord
changeset 15:3358be7b51d2
crecord: enable parent-folding ('F' key) [this commit done via crecord! :)]
author | Mark Edgington <edgimar@gmail.com> |
---|---|
date | Tue, 02 Dec 2008 22:04:41 +0100 |
parents | 43a315e2eb36 |
children | 3cc802f3e53e |
files | crecord.py |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/crecord.py +++ b/crecord.py @@ -828,10 +828,14 @@ if item.hunk.applied and not item.hunk.header.applied: item.hunk.header.applied = True - def toggleFolded(self, item=None): + def toggleFolded(self, item=None, foldParent=False): "Toggle folded flag of specified item (defaults to currently selected)" if item is None: item = self.currentSelectedItem + if not isinstance(item, header) and foldParent: + item = item.parentItem() + # we need to select the parent item in this case + self.currentSelectedItem = item if isinstance(item, (header, hunk)): item.folded = not item.folded @@ -1314,9 +1318,11 @@ break elif keyPressed in [ord(' ')]: self.toggleApply() - elif keyPressed in [ord("f")]: + elif keyPressed in [ord("f")]: self.toggleFolded() - elif keyPressed in [ord("?")]: + elif keyPressed in [ord("F")]: + self.toggleFolded(foldParent=True) + elif keyPressed in [ord("?")]: self.helpWindow() def crecord(ui, repo, *pats, **opts):