crecord: make KEY_ENTER usable in tests (by not updating UI)
authorKyle Lippincott <spectral@google.com>
Mon, 08 Jul 2019 13:06:46 -0700
changeset 42572 cd4f1b7c3192
parent 42571 3be6ff55095b
child 42573 9ac1a5a4a64f
crecord: make KEY_ENTER usable in tests (by not updating UI) Differential Revision: https://phab.mercurial-scm.org/D6620
mercurial/crecord.py
--- a/mercurial/crecord.py	Mon Jul 08 12:38:37 2019 -0700
+++ b/mercurial/crecord.py	Mon Jul 08 13:06:46 2019 -0700
@@ -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']: