summaryrefslogtreecommitdiffstats
path: root/Lib/_pyrepl/completing_reader.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/_pyrepl/completing_reader.py')
-rw-r--r--Lib/_pyrepl/completing_reader.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/Lib/_pyrepl/completing_reader.py b/Lib/_pyrepl/completing_reader.py
index c11d2da..8df35cc 100644
--- a/Lib/_pyrepl/completing_reader.py
+++ b/Lib/_pyrepl/completing_reader.py
@@ -187,18 +187,20 @@ class complete(commands.Command):
if p:
r.insert(p)
if last_is_completer:
- if not r.cmpltn_menu_visible:
- r.cmpltn_menu_visible = True
+ r.cmpltn_menu_visible = True
+ r.cmpltn_message_visible = False
r.cmpltn_menu, r.cmpltn_menu_end = build_menu(
r.console, completions, r.cmpltn_menu_end,
r.use_brackets, r.sort_in_column)
r.dirty = True
- elif stem + p in completions:
- r.msg = "[ complete but not unique ]"
- r.dirty = True
- else:
- r.msg = "[ not unique ]"
- r.dirty = True
+ elif not r.cmpltn_menu_visible:
+ r.cmpltn_message_visible = True
+ if stem + p in completions:
+ r.msg = "[ complete but not unique ]"
+ r.dirty = True
+ else:
+ r.msg = "[ not unique ]"
+ r.dirty = True
class self_insert(commands.self_insert):
@@ -208,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:
@@ -236,6 +241,7 @@ class CompletingReader(Reader):
### Instance variables
cmpltn_menu: list[str] = field(init=False)
cmpltn_menu_visible: bool = field(init=False)
+ cmpltn_message_visible: bool = field(init=False)
cmpltn_menu_end: int = field(init=False)
cmpltn_menu_choices: list[str] = field(init=False)
@@ -271,6 +277,7 @@ class CompletingReader(Reader):
def cmpltn_reset(self) -> None:
self.cmpltn_menu = []
self.cmpltn_menu_visible = False
+ self.cmpltn_message_visible = False
self.cmpltn_menu_end = 0
self.cmpltn_menu_choices = []