From caa50dcf146219e9233f7d17a5d859d345baca91 Mon Sep 17 00:00:00 2001 From: Anthony Kim <62267334+anthonykim1@users.noreply.github.com> Date: Tue, 28 Nov 2023 16:26:31 -0800 Subject: [PATCH] Fix shell integration decoration for windows pwsh (#22560) Attempting to fix shell integration decoration glitch for windows pwsh when using Python REPL from VS Code. Resolves: #22546 #22535 --- pythonFiles/pythonrc.py | 2 +- pythonFiles/tests/test_shell_integration.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pythonFiles/pythonrc.py b/pythonFiles/pythonrc.py index 632db2749bd8..f4fca30950f2 100644 --- a/pythonFiles/pythonrc.py +++ b/pythonFiles/pythonrc.py @@ -46,7 +46,7 @@ def __str__(self): # command_start="\x1b]633;B\x07", # command_executed="\x1b]633;C\x07", # ) - result = f"{chr(27)}]633;D;{exit_code}0{chr(7)}{chr(27)}]633;A{chr(7)}{original_ps1}{chr(27)}]633;B{chr(7)}{chr(27)}]633;C{chr(7)}" + result = f"{chr(27)}]633;D;{exit_code}{chr(7)}{chr(27)}]633;A{chr(7)}{original_ps1}{chr(27)}]633;B{chr(7)}{chr(27)}]633;C{chr(7)}" return result diff --git a/pythonFiles/tests/test_shell_integration.py b/pythonFiles/tests/test_shell_integration.py index c1359140438b..06bb42499c58 100644 --- a/pythonFiles/tests/test_shell_integration.py +++ b/pythonFiles/tests/test_shell_integration.py @@ -10,7 +10,7 @@ def test_decoration_success(): ps1.hooks.failure_flag = False result = str(ps1) - assert result == "\x1b]633;D;00\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07" + assert result == "\x1b]633;D;0\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07" def test_decoration_failure(): @@ -20,7 +20,7 @@ def test_decoration_failure(): ps1.hooks.failure_flag = True result = str(ps1) - assert result == "\x1b]633;D;10\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07" + assert result == "\x1b]633;D;1\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07" def test_displayhook_call():