Patchwork D6620: crecord: make KEY_ENTER usable in tests (by not updating UI)

login
register
mail settings
Submitter phabricator
Date July 8, 2019, 8:29 p.m.
Message ID <differential-rev-PHID-DREV-rnjehym5ntmuetaot64n-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/40831/
State Superseded
Headers show

Comments

phabricator - July 8, 2019, 8:29 p.m.
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6620

AFFECTED FILES
  mercurial/crecord.py

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -723,7 +723,7 @@ 
         self.currentselecteditem = nextitem
         self.recenterdisplayedarea()
 
-    def nextsametype(self):
+    def nextsametype(self, test=False):
         currentitem = self.currentselecteditem
         sametype = lambda item: isinstance(item, type(currentitem))
         nextitem = currentitem.nextitem()
@@ -739,7 +739,8 @@ 
                 self.togglefolded(parent)
 
         self.currentselecteditem = nextitem
-        self.recenterdisplayedarea()
+        if not test:
+            self.recenterdisplayedarea()
 
     def rightarrowevent(self):
         """
@@ -1753,7 +1754,7 @@ 
             self.toggleapply()
         elif keypressed in ['\n', 'KEY_ENTER']:
             self.toggleapply()
-            self.nextsametype()
+            self.nextsametype(test=test)
         elif keypressed in ['A']:
             self.toggleall()
         elif keypressed in ['e']: