File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,14 +39,15 @@ def __str__(self):
3939 exit_code = 0
4040
4141 # Guide following official VS Code doc for shell integration sequence:
42- # result = "{command_finished}{prompt_started}{prompt}{command_start}{command_executed}".format(
43- # command_finished="\x1b]633;D;" + str(exit_code) + "0\x07",
44- # prompt_started="\x1b]633;A\x07",
45- # prompt=original_ps1,
46- # command_start="\x1b]633;B\x07",
47- # command_executed="\x1b]633;C\x07",
48- # )
49- 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 )} "
42+ result = "{command_explicit}{command_finished}{prompt_started}{prompt}{command_start}{command_executed}" .format (
43+ command_explicit = "\x1b ]633;E;\x07 " ,
44+ command_finished = "\x1b ]633;D;" + str (exit_code ) + "\x07 " ,
45+ prompt_started = "\x1b ]633;A\x07 " ,
46+ prompt = original_ps1 ,
47+ command_start = "\x1b ]633;B\x07 " ,
48+ command_executed = "\x1b ]633;C\x07 " ,
49+ )
50+ # 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)}"
5051
5152 return result
5253
Original file line number Diff line number Diff line change @@ -10,7 +10,10 @@ def test_decoration_success():
1010
1111 ps1 .hooks .failure_flag = False
1212 result = str (ps1 )
13- assert result == "\x1b ]633;D;0\x07 \x1b ]633;A\x07 >>> \x1b ]633;B\x07 \x1b ]633;C\x07 "
13+ assert (
14+ result
15+ == "\x1b ]633;E;\x07 \x1b ]633;D;0\x07 \x1b ]633;A\x07 >>> \x1b ]633;B\x07 \x1b ]633;C\x07 "
16+ )
1417
1518
1619def test_decoration_failure ():
@@ -20,7 +23,10 @@ def test_decoration_failure():
2023 ps1 .hooks .failure_flag = True
2124 result = str (ps1 )
2225
23- assert result == "\x1b ]633;D;1\x07 \x1b ]633;A\x07 >>> \x1b ]633;B\x07 \x1b ]633;C\x07 "
26+ assert (
27+ result
28+ == "\x1b ]633;E;\x07 \x1b ]633;D;1\x07 \x1b ]633;A\x07 >>> \x1b ]633;B\x07 \x1b ]633;C\x07 "
29+ )
2430
2531
2632def test_displayhook_call ():
You can’t perform that action at this time.
0 commit comments