From ef1061acfb57eb18fedc0865219c2d8ddddab9f1 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sat, 8 Aug 2026 19:20:25 +0700 Subject: [PATCH] fix(files): say which file would not delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The file tree's delete failure read "Delete failed" with the OS reason appended — "Delete failed: Permission denied" — and never the name. In a tree of files that is the first thing you need, which is exactly the reason the editor's save failure stopped saying "Save failed" and started naming its file. The name is already in hand for the confirmation the delete opens with. --- src/ui/file_tree.rs | 9 ++++++++- src/ui/i18n/en.rs | 2 +- src/ui/i18n/ja.rs | 2 +- src/ui/i18n/zh.rs | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ui/file_tree.rs b/src/ui/file_tree.rs index d91d6ed1..2b1b2dc1 100644 --- a/src/ui/file_tree.rs +++ b/src/ui/file_tree.rs @@ -1178,6 +1178,10 @@ impl Tty7App { code.selected = None; } let target = path.clone(); + // "Delete failed: Permission denied" leaves out the one thing + // you need in a tree of files, the same way "Save failed" used + // to in the editor. + let failed_name = name.clone(); HostOps::run_in( host, window, @@ -1193,7 +1197,10 @@ impl Tty7App { HostOps::notify_err( window, cx, - t(L10nKey::FileTreeDeleteFailed), + &t_fmt( + L10nKey::FileTreeDeleteFailed, + &[("name", &failed_name)], + ), &e, ); } diff --git a/src/ui/i18n/en.rs b/src/ui/i18n/en.rs index fb3031ed..ce21baa1 100644 --- a/src/ui/i18n/en.rs +++ b/src/ui/i18n/en.rs @@ -806,7 +806,7 @@ pub fn translate_en(key: L10nKey) -> &'static str { L10nKey::SftpDeleteFileBody => { "The file will be deleted on {host}. There is no trash on the far side." } - L10nKey::FileTreeDeleteFailed => "Delete failed", + L10nKey::FileTreeDeleteFailed => "Could not delete {name}", L10nKey::FileTreeContextOpen => "Open", L10nKey::FileTreeContextCdHere => "cd Here", L10nKey::FileTreeContextInsertPath => "Insert Path in Terminal", diff --git a/src/ui/i18n/ja.rs b/src/ui/i18n/ja.rs index 5c2a9429..003f4bf9 100644 --- a/src/ui/i18n/ja.rs +++ b/src/ui/i18n/ja.rs @@ -847,7 +847,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> { L10nKey::SftpDeleteFileBody => { "{host} 上でファイルが削除されます。リモート側にゴミ箱はありません。" } - L10nKey::FileTreeDeleteFailed => "削除に失敗しました", + L10nKey::FileTreeDeleteFailed => "{name} を削除できませんでした", L10nKey::FileTreeContextOpen => "開く", L10nKey::FileTreeContextCdHere => "ここで cd", L10nKey::FileTreeContextInsertPath => "ターミナルにパスを挿入", diff --git a/src/ui/i18n/zh.rs b/src/ui/i18n/zh.rs index accdb309..b6873789 100644 --- a/src/ui/i18n/zh.rs +++ b/src/ui/i18n/zh.rs @@ -772,7 +772,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> { "该文件夹及其中所有内容将在 {host} 上被删除。远端没有回收站。" } L10nKey::SftpDeleteFileBody => "该文件将在 {host} 上被删除。远端没有回收站。", - L10nKey::FileTreeDeleteFailed => "删除失败", + L10nKey::FileTreeDeleteFailed => "无法删除 {name}", L10nKey::FileTreeContextOpen => "打开", L10nKey::FileTreeContextCdHere => "cd 到此处", L10nKey::FileTreeContextInsertPath => "在终端中插入路径",