summaryrefslogtreecommitdiffstats
path: root/Lib/_pyrepl/completing_reader.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-05-22 16:03:04 (GMT)
committerGitHub <noreply@github.com>2024-05-22 16:03:04 (GMT)
commitaefe2e626eeb2f05cda10a17926f8ba9b7a504ca (patch)
treed49408a37d65ab1ee30e2ba7887adc1a6b697a6d /Lib/_pyrepl/completing_reader.py
parentac9163637b028fc4b457f83b1a49b2f7ffbff6e6 (diff)
downloadcpython-aefe2e626eeb2f05cda10a17926f8ba9b7a504ca.zip
cpython-aefe2e626eeb2f05cda10a17926f8ba9b7a504ca.tar.gz
cpython-aefe2e626eeb2f05cda10a17926f8ba9b7a504ca.tar.bz2
[3.13] gh-111201: Add append to screen method to avoid recalculation (GH-119274) (#119405)
(cherry picked from commit c886bece3b3a49f8a0f188aecfc1d6ff89d281e6) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib/_pyrepl/completing_reader.py')
-rw-r--r--Lib/_pyrepl/completing_reader.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/_pyrepl/completing_reader.py b/Lib/_pyrepl/completing_reader.py
index 19fc06f..3f8506b 100644
--- a/Lib/_pyrepl/completing_reader.py
+++ b/Lib/_pyrepl/completing_reader.py
@@ -187,8 +187,8 @@ class complete(commands.Command):
if p:
r.insert(p)
if last_is_completer:
- if not r.cmpltn_menu_vis:
- r.cmpltn_menu_vis = 1
+ if not r.cmpltn_menu_visible:
+ r.cmpltn_menu_visible = True
r.cmpltn_menu, r.cmpltn_menu_end = build_menu(
r.console, completions, r.cmpltn_menu_end,
r.use_brackets, r.sort_in_column)
@@ -208,7 +208,7 @@ class self_insert(commands.self_insert):
commands.self_insert.do(self)
- if r.cmpltn_menu_vis:
+ if r.cmpltn_menu_visible:
stem = r.get_stem()
if len(stem) < 1:
r.cmpltn_reset()
@@ -235,7 +235,7 @@ class CompletingReader(Reader):
### Instance variables
cmpltn_menu: list[str] = field(init=False)
- cmpltn_menu_vis: int = field(init=False)
+ cmpltn_menu_visible: bool = field(init=False)
cmpltn_menu_end: int = field(init=False)
cmpltn_menu_choices: list[str] = field(init=False)
@@ -255,9 +255,9 @@ class CompletingReader(Reader):
if not isinstance(cmd, (complete, self_insert)):
self.cmpltn_reset()
- def calc_screen(self) -> list[str]:
- screen = super().calc_screen()
- if self.cmpltn_menu_vis:
+ def calc_complete_screen(self) -> list[str]:
+ screen = super().calc_complete_screen()
+ if self.cmpltn_menu_visible:
ly = self.lxy[1]
screen[ly:ly] = self.cmpltn_menu
self.screeninfo[ly:ly] = [(0, [])]*len(self.cmpltn_menu)
@@ -270,7 +270,7 @@ class CompletingReader(Reader):
def cmpltn_reset(self) -> None:
self.cmpltn_menu = []
- self.cmpltn_menu_vis = 0
+ self.cmpltn_menu_visible = False
self.cmpltn_menu_end = 0
self.cmpltn_menu_choices = []