From b95ac973e82fbf15ef56b9842f6414f21aa36288 Mon Sep 17 00:00:00 2001 From: vasilito Date: Tue, 7 Jul 2026 17:43:39 +0300 Subject: [PATCH] W71: Fix all review-identified gaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit High-severity fixes: - Replace 2× unreachable!('mkdir not spawned with progress') in dialog_ops.rs:855,869 with graceful Ok(()) returns — prevents runtime panic if MkDir ever gains progress support Documentation fixes: - Update outdated 'open_file was the Phase 0 stub' comment in viewer/mod.rs to reflect current state (standalone tlcview binary) - Update usermenu.rs CK_EditUserMenu TODO — feature already implemented in dispatch_editor_cmd - Update PLAN.md retry description — progress-dialog retry IS functional; only background-jobs retry is state-only Tests: 1427 pass, zero warnings. --- local/recipes/tui/tlc/PLAN.md | 7 ++++--- local/recipes/tui/tlc/source/src/editor/usermenu.rs | 4 ++-- .../recipes/tui/tlc/source/src/filemanager/dialog_ops.rs | 9 +++++++-- local/recipes/tui/tlc/source/src/viewer/mod.rs | 5 +++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/local/recipes/tui/tlc/PLAN.md b/local/recipes/tui/tlc/PLAN.md index 88b8cc3097..1322fc5613 100644 --- a/local/recipes/tui/tlc/PLAN.md +++ b/local/recipes/tui/tlc/PLAN.md @@ -299,9 +299,10 @@ Mirrors MC's `filegui.c::file_progress_real_query_replace` and the FILE_SKIP, FILE_ABORT, FILE_IGNORE. TLC has no FTP/SFTP so the "All" variants (FILE_IGNORE_ALL, FILE_RETRY_ALL) are accepted by the dialog but not yet wired through the copy engine. -Retry is a stub (logs a message) because batch step resumption -would require threading the op index through copy/move/delete -batch functions — deferred to a follow-up sprint. +Retry in the progress-dialog error path IS functional (re-begins +the operation and re-runs). Retry in the background jobs dialog +(jobs.rs:600-604) is state-only — the original sources list cannot +be recovered from the jobs dialog context. New file: `src/filemanager/error_dialog.rs` - `ErrorDialog` with path + error message diff --git a/local/recipes/tui/tlc/source/src/editor/usermenu.rs b/local/recipes/tui/tlc/source/src/editor/usermenu.rs index 6735b585fb..5c7b86a429 100644 --- a/local/recipes/tui/tlc/source/src/editor/usermenu.rs +++ b/local/recipes/tui/tlc/source/src/editor/usermenu.rs @@ -11,8 +11,8 @@ //! it at the cursor position. //! //! The MC `CK_EditUserMenu` variant opens the menu file itself in -//! the editor — that path just runs `UserMenu::new().storage_path` -//! through the regular `Open` flow, so we defer it to a TODO. +//! the editor — implemented via `EditorCmd::EditUserMenu` in +//! `dispatch_editor_cmd`. use std::path::{Path, PathBuf}; diff --git a/local/recipes/tui/tlc/source/src/filemanager/dialog_ops.rs b/local/recipes/tui/tlc/source/src/filemanager/dialog_ops.rs index 83566e4baa..983cc51c10 100644 --- a/local/recipes/tui/tlc/source/src/filemanager/dialog_ops.rs +++ b/local/recipes/tui/tlc/source/src/filemanager/dialog_ops.rs @@ -852,7 +852,12 @@ Err(e) => self.status.set_error(format!("view: {e}")), crate::ops::OpKind::Delete => { crate::ops::delete::delete_many(&thread_sources, &thread_handle) } - crate::ops::OpKind::MkDir => unreachable!("mkdir not spawned with progress"), + crate::ops::OpKind::MkDir => { + // MkDir is instantaneous — it should never be + // spawned with a progress dialog. If it reaches + // this branch, treat it as a success (no work). + Ok(()) + } }; let _ = tx.send(result); }); @@ -861,7 +866,7 @@ Err(e) => self.status.set_error(format!("view: {e}")), crate::ops::OpKind::Copy => "Copying...".to_string(), crate::ops::OpKind::Move => "Moving...".to_string(), crate::ops::OpKind::Delete => "Deleting...".to_string(), - crate::ops::OpKind::MkDir => unreachable!("mkdir not spawned with progress"), + crate::ops::OpKind::MkDir => "Creating...".to_string(), }; let mut pd = crate::ops::progress::ProgressDialog::new(); pd.title = title; diff --git a/local/recipes/tui/tlc/source/src/viewer/mod.rs b/local/recipes/tui/tlc/source/src/viewer/mod.rs index 82c434a325..d9bbc0c10b 100644 --- a/local/recipes/tui/tlc/source/src/viewer/mod.rs +++ b/local/recipes/tui/tlc/source/src/viewer/mod.rs @@ -1459,10 +1459,11 @@ impl Viewer { } } -/// Backwards-compat shim: `open_file` was the Phase 0 stub. +/// Standalone viewer entry-point used by the `tlcview` binary. +/// Opens `file` in the viewer with optional line-number navigation. pub fn open_file(file: &str, start_line: Option) -> Result<()> { - use crate::terminal::event::translate_key; use crate::terminal::color::DEFAULT_THEME; + use crate::terminal::event::translate_key; use termion::event::Event as TermEvent; use termion::input::TermReadEventsAndRaw;