Skip to content

Commit

Permalink
Fix shell integration decoration for windows pwsh (#22560)
Browse files Browse the repository at this point in the history
Attempting to fix shell integration decoration glitch for windows pwsh
when using Python REPL from VS Code.
Resolves: #22546 #22535
  • Loading branch information
anthonykim1 authored Nov 29, 2023
1 parent 3efb54f commit caa50dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pythonFiles/pythonrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pythonFiles/tests/test_shell_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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():
Expand Down

0 comments on commit caa50dc

Please sign in to comment.