From 611d8c64d0875fa38d77ae947693441dc4cc47fe Mon Sep 17 00:00:00 2001 From: electricmessiah <3809405+electricmessiah@users.noreply.github.com> Date: Wed, 8 Jul 2026 16:25:56 -0400 Subject: [PATCH] Fix: don't error on focus regain when file was deleted externally --- src/platform/win32.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/platform/win32.rs b/src/platform/win32.rs index db63363..ba758a8 100644 --- a/src/platform/win32.rs +++ b/src/platform/win32.rs @@ -2851,6 +2851,13 @@ fn check_external_change(hwnd: HWND, state: &mut AppState) -> Result<()> { .get(index) .and_then(|doc_tab| doc_tab.doc.stamp.clone()); + if !path.exists() { + // File was deleted, renamed, or is on an unmounted drive. Leave the + // tab as-is rather than erroring on every focus regain; the user + // still has the in-memory content and can Save As if needed. + return Ok(()); + } + if let Some(new_stamp) = document::check_stamp(&path, &stamp)? { if prompt_reload(hwnd) { reload_doc_from_path(hwnd, state, index, &path)?;