From e46a2fbbb66f96760034daf569748285b03cbe99 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sat, 8 Aug 2026 23:04:21 +0700 Subject: [PATCH] fix(sftp): let double-click open a file, not just a folder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The gesture ran sftp_enter_dir, which returns early for anything that is not a directory. Double-clicking a file — what every file browser, and every SFTP client, answers by opening it — did nothing at all: no transfer, no cursor change, no message. The row menu right beside it offers Download, and sftp_open_entry already handles both kinds. Point the gesture at that instead and drop the directory-only handler, which had no other caller. A download shows up in the transfers tray and can be cancelled from it, so the worst case is a click you can take back. Verified against a real SSH connection to localhost: double-clicking a file now lands it in ~/Downloads at the right size, and double-clicking a folder still navigates into it. --- src/ui/sftp.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/ui/sftp.rs b/src/ui/sftp.rs index 60974196..0785cd0e 100644 --- a/src/ui/sftp.rs +++ b/src/ui/sftp.rs @@ -515,13 +515,12 @@ impl Tty7App { cx.notify(); } - pub(crate) fn sftp_enter_dir(&mut self, entry: SftpEntry, cx: &mut Context) { - if is_dir_like(&entry) { - let target = remote_join(&self.sftp_panel.cwd, &entry.name); - self.sftp_navigate(target, cx); - } - } - + /// The double-click gesture and the row menu's first item both land here. + /// They used to differ: double-click ran a directory-only handler, so + /// double-clicking a file — the gesture every file browser answers by + /// opening it — did nothing at all, with no cursor change or message to + /// say why. A download is visible in the transfers tray and cancellable + /// from it, so the worst case is a click you can take back. pub(crate) fn sftp_open_entry(&mut self, entry: SftpEntry, cx: &mut Context) { let target = remote_join(&self.sftp_panel.cwd, &entry.name); if is_dir_like(&entry) { @@ -1333,7 +1332,7 @@ impl Tty7App { .cursor_pointer() .hover(|s| s.bg(list_hover)) .on_double_click( - cx.listener(move |this, _, _w, cx| this.sftp_enter_dir(open_entry.clone(), cx)), + cx.listener(move |this, _, _w, cx| this.sftp_open_entry(open_entry.clone(), cx)), ) .child( Icon::new(icon)