]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-120041: Refactor check for visible completion menu in completing_reader (#120055)
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Tue, 4 Jun 2024 17:26:44 +0000 (19:26 +0200)
committerGitHub <noreply@github.com>
Tue, 4 Jun 2024 17:26:44 +0000 (19:26 +0200)
Lib/_pyrepl/commands.py
Lib/_pyrepl/completing_reader.py

index b967f5206614f882b5c7e09c490ca70eabd06a0d..2ef5dada9d9e5886afc399b69440dd815bffa0aa 100644 (file)
@@ -365,12 +365,7 @@ class self_insert(EditCommand):
         r = self.reader
         text = self.event * r.get_arg()
         r.insert(text)
-        if (
-            len(text) == 1 and
-            r.pos == len(r.buffer) and
-            not r.cmpltn_menu_visible and  # type: ignore[attr-defined]
-            not r.cmpltn_message_visible  # type: ignore[attr-defined]
-        ):
+        if len(text) == 1 and r.pos == len(r.buffer):
             r.calc_screen = r.append_to_screen
 
 
index 215ad8753c9f8b1e0d230b9396f7ff5d33a9d1ee..8df35ccb9117b146e6636a0fa441cd4f1f6591d2 100644 (file)
@@ -210,6 +210,9 @@ class self_insert(commands.self_insert):
 
         commands.self_insert.do(self)
 
+        if r.cmpltn_menu_visible or r.cmpltn_message_visible:
+            r.calc_screen = r.calc_complete_screen
+
         if r.cmpltn_menu_visible:
             stem = r.get_stem()
             if len(stem) < 1: