mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
[3.13] gh-121609: Fix pasting of characters containing unicode character joiner (GH-121667) (#121733)
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
This commit is contained in:
parent
e8594aadd5
commit
e28f863bd5
3 changed files with 7 additions and 1 deletions
|
@ -58,7 +58,6 @@ def disp_str(buffer: str) -> tuple[str, list[int]]:
|
||||||
elif unicodedata.category(c).startswith("C"):
|
elif unicodedata.category(c).startswith("C"):
|
||||||
c = r"\u%04x" % ord(c)
|
c = r"\u%04x" % ord(c)
|
||||||
s.append(c)
|
s.append(c)
|
||||||
b.append(str_width(c))
|
|
||||||
b.extend([0] * (len(c) - 1))
|
b.extend([0] * (len(c) - 1))
|
||||||
else:
|
else:
|
||||||
s.append(c)
|
s.append(c)
|
||||||
|
|
|
@ -89,6 +89,12 @@ class TestReader(TestCase):
|
||||||
reader.setpos_from_xy(0, 0)
|
reader.setpos_from_xy(0, 0)
|
||||||
self.assertEqual(reader.pos, 0)
|
self.assertEqual(reader.pos, 0)
|
||||||
|
|
||||||
|
def test_control_characters(self):
|
||||||
|
code = 'flag = "🏳️🌈"'
|
||||||
|
events = code_to_events(code)
|
||||||
|
reader, _ = handle_all_events(events)
|
||||||
|
self.assert_screen_equals(reader, 'flag = "🏳️\\u200d🌈"')
|
||||||
|
|
||||||
def test_setpos_from_xy_multiple_lines(self):
|
def test_setpos_from_xy_multiple_lines(self):
|
||||||
# fmt: off
|
# fmt: off
|
||||||
code = (
|
code = (
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fix pasting of characters containing unicode character joiners in the new REPL. Patch by Marta Gomez Macias
|
Loading…
Add table
Add a link
Reference in a new issue