mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-27 03:11:46 +00:00
Merge branch 'detect-ssh-drop' of https://github.com/waresnew/kitty
This commit is contained in:
commit
d02f30ca31
3 changed files with 13 additions and 4 deletions
|
|
@ -736,12 +736,12 @@ func run_ssh(ssh_args, server_args, found_extra_args []string) (rc int, err erro
|
|||
cd.hostname_for_match, cd.username = hostname_for_match, uname
|
||||
escape_codes_to_set_colors, err := change_colors(cd.host_opts.Color_scheme)
|
||||
if err == nil {
|
||||
err = term.WriteAllString(escape_codes_to_set_colors + loop.SAVE_PRIVATE_MODE_VALUES + loop.HANDLE_TERMIOS_SIGNALS.EscapeCodeToSet())
|
||||
err = term.WriteAllString(escape_codes_to_set_colors + loop.SAVE_PRIVATE_MODE_VALUES + loop.PUSH_KEY_FLAGS + loop.HANDLE_TERMIOS_SIGNALS.EscapeCodeToSet())
|
||||
}
|
||||
if err != nil {
|
||||
return 1, err
|
||||
}
|
||||
restore_escape_codes := loop.RESTORE_PRIVATE_MODE_VALUES + loop.HANDLE_TERMIOS_SIGNALS.EscapeCodeToReset()
|
||||
restore_escape_codes := loop.RESTORE_PRIVATE_MODE_VALUES + loop.POP_KEY_FLAGS + loop.HANDLE_TERMIOS_SIGNALS.EscapeCodeToReset()
|
||||
if escape_codes_to_set_colors != "" {
|
||||
restore_escape_codes += "\x1b[#Q"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -962,8 +962,9 @@ class EditCmd:
|
|||
|
||||
def __del__(self) -> None:
|
||||
if self.tdir:
|
||||
with suppress(OSError):
|
||||
shutil.rmtree(self.tdir)
|
||||
if not self.abort_signaled == 'disconnected':
|
||||
with suppress(OSError):
|
||||
shutil.rmtree(self.tdir)
|
||||
self.tdir = ''
|
||||
|
||||
def read_data(self) -> bytes:
|
||||
|
|
@ -1002,6 +1003,12 @@ class EditCmd:
|
|||
self.schedule_check()
|
||||
|
||||
def send_data(self, window: Window, data_type: str, data: bytes = b'') -> None:
|
||||
if not self.is_local_file and not window.child_is_remote:
|
||||
self.abort_signaled = 'disconnected'
|
||||
get_boss().show_error(
|
||||
'edit-in-kitty', f'Failed to sync file due to the SSH connection dropping. Your local changes can still be found at {self.file_localpath}'
|
||||
)
|
||||
return
|
||||
window.write_to_child(f'KITTY_DATA_START\n{data_type}\n')
|
||||
if data:
|
||||
import base64
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ const (
|
|||
RESTORE_COLORS = "\033[#Q"
|
||||
DECSACE_DEFAULT_REGION_SELECT = "\033[*x"
|
||||
CLEAR_SCREEN = "\033[H\033[2J"
|
||||
POP_KEY_FLAGS = "\033[<u"
|
||||
PUSH_KEY_FLAGS = "\033[>u"
|
||||
)
|
||||
|
||||
type CursorShapes uint
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue