diff --git a/Lib/_pyrepl/reader.py b/Lib/_pyrepl/reader.py index e44e611e6fb8b7..c4d6b9ce0951b8 100644 --- a/Lib/_pyrepl/reader.py +++ b/Lib/_pyrepl/reader.py @@ -373,6 +373,14 @@ def calc_screen(self) -> list[str]: prompt = "" else: prompt = self.get_prompt(ln, ll >= pos >= 0) + trace("prompt = " + str(prompt)) + trace("screen before while loop = " + str(screen)) + while "\n" in prompt: + pre_prompt, _, prompt = prompt.partition("\n") + last_refresh_line_end_offsets.append(offset) + screen.append(pre_prompt) + screeninfo.append((0, [])) + trace("screen after while loop = " + str(screen)) pos -= ll + 1 prompt, lp = self.process_prompt(prompt) l, l2 = disp_str(line) diff --git a/Lib/test/test_pyrepl/test_reader.py b/Lib/test/test_pyrepl/test_reader.py index 6c72a1d39c55df..d02ee34772ade7 100644 --- a/Lib/test/test_pyrepl/test_reader.py +++ b/Lib/test/test_pyrepl/test_reader.py @@ -312,3 +312,6 @@ def test_key_press_on_tab_press_once(self): reader, _ = handle_all_events(events, prepare_reader=completing_reader) self.assert_screen_equals(reader, f"{code}a") + + def test_tmp(self): + self.assertListEqual([1], [2])