mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
gh-119896: Fix CTRL-Z behavior in the new REPL on Windows (GH-122217)
This commit is contained in:
parent
d27a53fc02
commit
d1a1bca1f0
4 changed files with 14 additions and 4 deletions
|
@ -21,4 +21,5 @@ def wlen(s: str) -> int:
|
|||
length = sum(str_width(i) for i in s)
|
||||
# remove lengths of any escape sequences
|
||||
sequence = ANSI_ESCAPE_SEQUENCE.findall(s)
|
||||
return length - sum(len(i) for i in sequence)
|
||||
ctrl_z_cnt = s.count('\x1a')
|
||||
return length - sum(len(i) for i in sequence) + ctrl_z_cnt
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue