mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-22 08:18:08 +02:00
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:
@@ -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:
|
def run_cmd(global_opts: RCOptions, cmd: str, func: RemoteCommand, opts: Any, items: List[str]) -> None:
|
||||||
from .remote_control import do_io
|
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)
|
payload = func.message_to_kitty(global_opts, opts, items)
|
||||||
send = {
|
send = {
|
||||||
'cmd': cmd,
|
'cmd': cmd,
|
||||||
@@ -154,13 +154,11 @@ def run_cmd(global_opts: RCOptions, cmd: str, func: RemoteCommand, opts: Any, it
|
|||||||
send['payload'] = payload
|
send['payload'] = payload
|
||||||
response = do_io(global_opts.to, send, func.no_response)
|
response = do_io(global_opts.to, send, func.no_response)
|
||||||
if not response.get('ok'):
|
if not response.get('ok'):
|
||||||
print(end=output_prefix, flush=True)
|
|
||||||
if response.get('tb'):
|
if response.get('tb'):
|
||||||
print_err(response['tb'])
|
print_err(response['tb'])
|
||||||
print_err(response['error'])
|
print_err(response['error'])
|
||||||
return
|
return
|
||||||
if 'data' in response:
|
if 'data' in response:
|
||||||
print(end=output_prefix, flush=True)
|
|
||||||
print(response['data'])
|
print(response['data'])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user