Skip to content

Commit 98aaab1

Browse files
authored
Tweak Python shell integration for lsp completion (#25082)
Resolves: #25012
1 parent c246e0e commit 98aaab1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

python_files/pythonrc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ def __str__(self):
5353
result = ""
5454
# For non-windows allow recent_command history.
5555
if sys.platform != "win32":
56-
result = "{command_line}{command_finished}{prompt_started}{prompt}{command_start}{command_executed}".format(
56+
result = "{command_executed}{command_line}{command_finished}{prompt_started}{prompt}{command_start}".format(
57+
command_executed="\x1b]633;C\x07",
5758
command_line="\x1b]633;E;" + str(get_last_command()) + "\x07",
5859
command_finished="\x1b]633;D;" + str(exit_code) + "\x07",
5960
prompt_started="\x1b]633;A\x07",
6061
prompt=original_ps1,
6162
command_start="\x1b]633;B\x07",
62-
command_executed="\x1b]633;C\x07",
6363
)
6464
else:
6565
result = "{command_finished}{prompt_started}{prompt}{command_start}{command_executed}".format(

python_files/tests/test_shell_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_decoration_success():
1717
if sys.platform != "win32" and (not is_wsl):
1818
assert (
1919
result
20-
== "\x1b]633;E;None\x07\x1b]633;D;0\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07"
20+
== "\x1b]633;C\x07\x1b]633;E;None\x07\x1b]633;D;0\x07\x1b]633;A\x07>>> \x1b]633;B\x07"
2121
)
2222
else:
2323
pass
@@ -32,7 +32,7 @@ def test_decoration_failure():
3232
if sys.platform != "win32" and (not is_wsl):
3333
assert (
3434
result
35-
== "\x1b]633;E;None\x07\x1b]633;D;1\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07"
35+
== "\x1b]633;C\x07\x1b]633;E;None\x07\x1b]633;D;1\x07\x1b]633;A\x07>>> \x1b]633;B\x07"
3636
)
3737
else:
3838
pass

0 commit comments

Comments
 (0)