Mercurial > hg > crecord
changeset 42:2af4836f6d61
crecord: modify left-arrow behavior slightly -- first tries to fold if node is foldable
author | Mark Edgington <edgimar@gmail.com> |
---|---|
date | Wed, 25 Feb 2009 00:40:10 +0100 |
parents | 032bba868ec0 |
children | 3da2e3be7333 |
files | crecord/chunk_selector.py |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/crecord/chunk_selector.py +++ b/crecord/chunk_selector.py @@ -197,11 +197,20 @@ def leftArrowEvent(self): """ - Select (if possible) the parent of this item. - Otherwise, if this item is a header, then fold it. + If the current item can be folded (i.e. it is an unfolded header or + hunk), then fold it. Otherwise try select (if possible) the parent + of this item. """ currentItem = self.currentSelectedItem + + # try to fold the item + if not isinstance(currentItem, HunkLine): + if not currentItem.folded: + self.toggleFolded(item=currentItem) + return + + # if it can't be folded, try to select the parent item nextItem = currentItem.parentItem() if nextItem is None: