tlc: cleanup — remove dead code, debug logging, fix import placement
- Remove two dead pub fn render free functions (render.rs + mod.rs) - Remove debug_raw_event/should_log_raw_event (always-on /tmp logging) - Move use std::sync::Arc to top of dispatch.rs - Fix unused imports from dead code removal
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
//! 4. On `Cmd::Quit` (or terminal EOF), tear down cleanly.
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::io::Write;
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::Result;
|
||||
@@ -70,7 +69,7 @@ impl Application {
|
||||
|
||||
let stdin = std::io::stdin();
|
||||
let mut events = stdin.lock().events_and_raw();
|
||||
let (event, raw) = match events.next() {
|
||||
let (event, _raw) = match events.next() {
|
||||
Some(Ok(pair)) => pair,
|
||||
Some(Err(e)) => {
|
||||
log::debug!("input error: {e}");
|
||||
@@ -78,9 +77,6 @@ impl Application {
|
||||
}
|
||||
None => break,
|
||||
};
|
||||
if should_log_raw_event(&event) {
|
||||
debug_raw_event(&event, &raw);
|
||||
}
|
||||
let tk = match event {
|
||||
TermEvent::Key(k) => k,
|
||||
TermEvent::Mouse(_) => continue,
|
||||
@@ -439,43 +435,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn should_log_raw_event(event: &TermEvent) -> bool {
|
||||
matches!(
|
||||
event,
|
||||
TermEvent::Key(
|
||||
TermKey::ShiftLeft
|
||||
| TermKey::AltLeft
|
||||
| TermKey::CtrlLeft
|
||||
| TermKey::ShiftRight
|
||||
| TermKey::AltRight
|
||||
| TermKey::CtrlRight
|
||||
| TermKey::ShiftUp
|
||||
| TermKey::AltUp
|
||||
| TermKey::CtrlUp
|
||||
| TermKey::ShiftDown
|
||||
| TermKey::AltDown
|
||||
| TermKey::CtrlDown
|
||||
| TermKey::CtrlHome
|
||||
| TermKey::CtrlEnd
|
||||
| TermKey::BackTab
|
||||
) | TermEvent::Unsupported(_)
|
||||
)
|
||||
}
|
||||
|
||||
fn debug_raw_event(event: &TermEvent, raw: &[u8]) {
|
||||
let hex = raw
|
||||
.iter()
|
||||
.map(|b| format!("{b:02X}"))
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
if let Ok(mut f) = std::fs::OpenOptions::new()
|
||||
.create(true)
|
||||
.append(true)
|
||||
.open("/tmp/tlc-debug.log")
|
||||
{
|
||||
let _ = writeln!(f, "{event:?} raw=[{hex}]");
|
||||
}
|
||||
}
|
||||
|
||||
/// CLI argument struct (re-exported at crate root).
|
||||
#[derive(Debug, Clone, Default)]
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
//! outcome. The Ctrl-X chord entry point, [`dispatch_ctrl_x_followup`],
|
||||
//! resolves the second key and re-dispatches the chosen [`Cmd`].
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::filemanager::{
|
||||
@@ -683,6 +685,4 @@ impl FileManager {
|
||||
}
|
||||
consumed
|
||||
}
|
||||
}
|
||||
|
||||
use std::sync::Arc;
|
||||
}
|
||||
@@ -56,7 +56,9 @@ use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use anyhow::Result;
|
||||
#[cfg(test)]
|
||||
use ratatui::layout::Rect;
|
||||
#[cfg(test)]
|
||||
use ratatui::Frame;
|
||||
|
||||
use crate::config::{Config, FilemanagerConfig};
|
||||
@@ -642,11 +644,6 @@ fn panel_footer_text(panel: &Panel) -> String {
|
||||
format_utils::panel_footer_text(panel)
|
||||
}
|
||||
|
||||
/// Render the file manager into a frame at the given area.
|
||||
pub fn render(fm: &mut FileManager, frame: &mut Frame, area: Rect) {
|
||||
fm.render(frame, area);
|
||||
}
|
||||
|
||||
/// Re-export the panel sort field at module level.
|
||||
pub use self::panel::SortField as PanelSortField;
|
||||
|
||||
|
||||
@@ -22,11 +22,6 @@ use crate::vfs::local::Entry;
|
||||
use super::filehighlight;
|
||||
use super::panel;
|
||||
|
||||
/// Render the file manager to a ratatui frame.
|
||||
pub fn render(fm: &mut FileManager, frame: &mut Frame, area: Rect) {
|
||||
fm.render(frame, area);
|
||||
}
|
||||
|
||||
impl FileManager {
|
||||
/// Render the file manager to a ratatui frame.
|
||||
pub fn render(&mut self, frame: &mut Frame, area: Rect) {
|
||||
|
||||
Reference in New Issue
Block a user