Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGcd4f1b7c3192: crecord: make KEY_ENTER usable in tests (by not updating UI)
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
pulkit |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/crecord.py (7 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
f3790fd8549e | a82094c1ae2c | Kyle Lippincott | Jul 8 2019, 4:06 PM |
nextitem = None | nextitem = None | ||||
if nextitem is None: | if nextitem is None: | ||||
# if parent has no next sibling, then no change... | # if parent has no next sibling, then no change... | ||||
nextitem = currentitem | nextitem = currentitem | ||||
self.currentselecteditem = nextitem | self.currentselecteditem = nextitem | ||||
self.recenterdisplayedarea() | self.recenterdisplayedarea() | ||||
def nextsametype(self): | def nextsametype(self, test=False): | ||||
currentitem = self.currentselecteditem | currentitem = self.currentselecteditem | ||||
sametype = lambda item: isinstance(item, type(currentitem)) | sametype = lambda item: isinstance(item, type(currentitem)) | ||||
nextitem = currentitem.nextitem() | nextitem = currentitem.nextitem() | ||||
while nextitem is not None and not sametype(nextitem): | while nextitem is not None and not sametype(nextitem): | ||||
nextitem = nextitem.nextitem() | nextitem = nextitem.nextitem() | ||||
if nextitem is None: | if nextitem is None: | ||||
nextitem = currentitem | nextitem = currentitem | ||||
else: | else: | ||||
parent = nextitem.parentitem() | parent = nextitem.parentitem() | ||||
if parent is not None and parent.folded: | if parent is not None and parent.folded: | ||||
self.togglefolded(parent) | self.togglefolded(parent) | ||||
self.currentselecteditem = nextitem | self.currentselecteditem = nextitem | ||||
if not test: | |||||
self.recenterdisplayedarea() | self.recenterdisplayedarea() | ||||
def rightarrowevent(self): | def rightarrowevent(self): | ||||
""" | """ | ||||
select (if possible) the first of this item's child-items. | select (if possible) the first of this item's child-items. | ||||
""" | """ | ||||
currentitem = self.currentselecteditem | currentitem = self.currentselecteditem | ||||
nextitem = currentitem.firstchild() | nextitem = currentitem.firstchild() | ||||
return True | return True | ||||
elif test and keypressed in ['R']: | elif test and keypressed in ['R']: | ||||
self.opts['review'] = True | self.opts['review'] = True | ||||
return True | return True | ||||
elif keypressed in [' ', 'x']: | elif keypressed in [' ', 'x']: | ||||
self.toggleapply() | self.toggleapply() | ||||
elif keypressed in ['\n', 'KEY_ENTER']: | elif keypressed in ['\n', 'KEY_ENTER']: | ||||
self.toggleapply() | self.toggleapply() | ||||
self.nextsametype() | self.nextsametype(test=test) | ||||
elif keypressed in ['A']: | elif keypressed in ['A']: | ||||
self.toggleall() | self.toggleall() | ||||
elif keypressed in ['e']: | elif keypressed in ['e']: | ||||
self.toggleedit(test=test) | self.toggleedit(test=test) | ||||
elif keypressed in ["f"]: | elif keypressed in ["f"]: | ||||
self.togglefolded() | self.togglefolded() | ||||
elif keypressed in ["F"]: | elif keypressed in ["F"]: | ||||
self.togglefolded(foldparent=True) | self.togglefolded(foldparent=True) |