Mark output before running command

This will help with shell integration erasing the prompt if there is a
resize caused by the command
This commit is contained in:
Kovid Goyal
2021-10-25 20:40:55 +05:30
parent 01ebc8f15a
commit 9b7342b231

View File

@@ -143,7 +143,7 @@ def print_help(which: Optional[str] = None) -> None:
def run_cmd(global_opts: RCOptions, cmd: str, func: RemoteCommand, opts: Any, items: List[str]) -> None:
from .remote_control import do_io
print(end=set_window_title(cmd), flush=True)
print(end=set_window_title(cmd) + output_prefix, flush=True)
payload = func.message_to_kitty(global_opts, opts, items)
send = {
'cmd': cmd,
@@ -154,13 +154,11 @@ def run_cmd(global_opts: RCOptions, cmd: str, func: RemoteCommand, opts: Any, it
send['payload'] = payload
response = do_io(global_opts.to, send, func.no_response)
if not response.get('ok'):
print(end=output_prefix, flush=True)
if response.get('tb'):
print_err(response['tb'])
print_err(response['error'])
return
if 'data' in response:
print(end=output_prefix, flush=True)
print(response['data'])