mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
(cherry picked from commite6572e8f98
) Also includes: * gh-111201: Use calc_complete_screen after bracketed paste in PyREPL (GH-119432) (cherry picked from commit14b063cbf1
) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
parent
9fa1b4fc46
commit
58dbb4a4b0
6 changed files with 22 additions and 16 deletions
|
@ -54,7 +54,7 @@ def disp_str(buffer: str) -> tuple[str, list[int]]:
|
|||
b: list[int] = []
|
||||
s: list[str] = []
|
||||
for c in buffer:
|
||||
if unicodedata.category(c).startswith("C"):
|
||||
if ord(c) > 128 and unicodedata.category(c).startswith("C"):
|
||||
c = r"\u%04x" % ord(c)
|
||||
s.append(c)
|
||||
b.append(wlen(c))
|
||||
|
@ -225,7 +225,7 @@ class Reader:
|
|||
dirty: bool = False
|
||||
finished: bool = False
|
||||
paste_mode: bool = False
|
||||
was_paste_mode_activated: bool = False
|
||||
in_bracketed_paste: bool = False
|
||||
commands: dict[str, type[Command]] = field(default_factory=make_default_commands)
|
||||
last_command: type[Command] | None = None
|
||||
syntax_table: dict[str, int] = field(default_factory=make_default_syntax_table)
|
||||
|
@ -454,7 +454,7 @@ class Reader:
|
|||
elif "\n" in self.buffer:
|
||||
if lineno == 0:
|
||||
prompt = self.ps2
|
||||
elif lineno == self.buffer.count("\n"):
|
||||
elif self.ps4 and lineno == self.buffer.count("\n"):
|
||||
prompt = self.ps4
|
||||
else:
|
||||
prompt = self.ps3
|
||||
|
@ -617,7 +617,7 @@ class Reader:
|
|||
|
||||
self.after_command(command)
|
||||
|
||||
if self.dirty:
|
||||
if self.dirty and not self.in_bracketed_paste:
|
||||
self.refresh()
|
||||
else:
|
||||
self.update_cursor()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue