From f07b1724d9d1af2f773d4fe4d5d7163db9a37c73 Mon Sep 17 00:00:00 2001 From: zach Date: Thu, 4 Jun 2026 14:45:35 +0200 Subject: [PATCH] fix compiler warning --- src/bin/bench_process.rs | 1 - src/box_drawing.rs | 1 - src/main.rs | 77 +++++++--------------------------------- src/renderer.rs | 2 +- src/terminal.rs | 1 - src/vt_test_osc.rs | 1 + 6 files changed, 14 insertions(+), 69 deletions(-) diff --git a/src/bin/bench_process.rs b/src/bin/bench_process.rs index b977f96..de46956 100644 --- a/src/bin/bench_process.rs +++ b/src/bin/bench_process.rs @@ -1,7 +1,6 @@ use zterm::terminal::Terminal; use zterm::vt_parser::Parser; use std::time::Instant; -use std::io::Write; const ASCII_PRINTABLE: &[u8] = b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ `~!@#$%^&*()_+-=[]{}\\|;:'\",<.>/?"; const CONTROL_CHARS: &[u8] = b"\n\t"; diff --git a/src/box_drawing.rs b/src/box_drawing.rs index 1c408c9..e04168b 100644 --- a/src/box_drawing.rs +++ b/src/box_drawing.rs @@ -521,7 +521,6 @@ pub fn render_box_char( c: char, cell_width: usize, cell_height: usize, - font_size: f32, dpi: f64, ) -> Option<(Vec, bool)> { let w = cell_width; diff --git a/src/main.rs b/src/main.rs index bf4f65a..17d3294 100644 --- a/src/main.rs +++ b/src/main.rs @@ -174,7 +174,7 @@ impl Pane { /// Calculate the current dim factor based on animation progress. /// Returns a value between `inactive_dim` (for unfocused) and 1.0 (for focused). /// Check if the fade animation is still in progress for this pane. - pub fn is_fade_in_progress(&self, fade_duration_ms: u64, was_focused: bool) -> bool { + pub fn is_fade_in_progress(&self, fade_duration_ms: u64) -> bool { if fade_duration_ms == 0 { return false; } @@ -710,8 +710,9 @@ impl Tab { self.panes.get(&self.active_pane) } - /// Get the active pane mutably. - fn active_pane_mut(&mut self) -> Option<&mut Pane> { + /// Get the active pane mutably. + #[allow(dead_code)] + fn active_pane_mut(&mut self) -> Option<&mut Pane> { self.panes.get_mut(&self.active_pane) } @@ -1641,14 +1642,8 @@ impl App { let mut last_tick_at = std::time::Instant::now(); let mut has_pending_data = false; - // Debug tracking - let mut total_bytes_read: u64 = 0; - let mut loop_count: u64 = 0; - let io_start = std::time::Instant::now(); - while !shutdown.load(Ordering::Relaxed) { events.clear(); - loop_count += 1; // Check if we have space - if not, disable PTY polling until woken let has_space = shared_parser.has_space(); @@ -1736,7 +1731,6 @@ impl App { break; } else { bytes_this_loop += result as i64; - total_bytes_read += result as u64; has_pending_data = true; // Check if buffer became full if !shared_parser.has_space() { @@ -1872,6 +1866,7 @@ impl App { /// 2. Parsing happens in-place - no copying data out of buffer /// 3. end_parse_pass() reports consumed bytes, wakes I/O only if buffer was full /// 4. Loop continues parsing as long as time budget allows + #[allow(unused_assignments)] fn poll_pane(&mut self, pane_id: PaneId) -> (bool, bool) { let mut ever_processed = false; let mut all_commands = Vec::new(); @@ -2022,8 +2017,7 @@ impl App { tab.panes .get(pane_id) .map(|p| { - let is_active = *pane_id == active_pane_id; - p.is_fade_in_progress(fade_duration_ms, is_active) + p.is_fade_in_progress(fade_duration_ms) }) .unwrap_or(false) }); @@ -2186,8 +2180,7 @@ impl App { tab.panes .get(pane_id) .map(|p| { - let is_active = *pane_id == active_pane_id; - p.is_fade_in_progress(fade_duration_ms, is_active) + p.is_fade_in_progress(fade_duration_ms) }) .unwrap_or(false) }); @@ -2248,6 +2241,7 @@ impl App { } /// Get the active pane of the active tab mutably, if any. + #[allow(dead_code)] fn active_pane_mut(&mut self) -> Option<&mut Pane> { self.active_tab_mut().and_then(|t| t.active_pane_mut()) } @@ -2270,18 +2264,6 @@ impl App { } } - fn get_scroll_offset(&self) -> usize { - self.active_pane() - .map(|p| p.terminal.scroll_offset) - .unwrap_or(0) - } - - fn has_mouse_tracking(&self) -> bool { - self.active_pane() - .map(|p| p.terminal.mouse_tracking != MouseTrackingMode::None) - .unwrap_or(false) - } - fn has_mouse_tracking_for_pane(&self, pane_id: PaneId) -> bool { self.active_tab() .and_then(|t| t.panes.get(&pane_id)) @@ -2289,12 +2271,6 @@ impl App { .unwrap_or(false) } - /// Find the pane geometry at a given pixel position in the active tab. - fn pane_at_pixel(&self, x: f64, y: f64) -> Option { - self.active_tab() - .and_then(|t| t.split_root.find_pane_at_pixel(x, y)) - } - fn get_mouse_modifiers(&self) -> u8 { let mod_state = self.modifiers.state(); let mut mods = 0u8; @@ -2310,35 +2286,6 @@ impl App { mods } - fn send_mouse_event( - &mut self, - pane_id: PaneId, - button: u8, - col: u16, - row: u16, - pressed: bool, - is_motion: bool, - ) { - let modifiers = self.get_mouse_modifiers(); - let Some(tab) = self.active_tab_mut() else { - return; - }; - let Some(pane) = tab.panes.get_mut(&pane_id) else { - return; - }; - let seq = pane.terminal.encode_mouse( - button, - col, - row, - pressed, - is_motion, - modifiers, - ); - if !seq.is_empty() { - pane.pty.write(&seq); - } - } - fn check_keybinding(&mut self, event: &KeyEvent) -> bool { if event.state != ElementState::Pressed || event.repeat { return false; @@ -3125,7 +3072,7 @@ impl ApplicationHandler for App { modifiers, ); if !seq.is_empty() { - pane.pty.write(&seq); + let _ = pane.pty.write(&seq); } } } @@ -3202,7 +3149,7 @@ impl ApplicationHandler for App { modifiers, ); if !seq.is_empty() { - pane.pty.write(&seq); + let _ = pane.pty.write(&seq); } } } @@ -3418,8 +3365,8 @@ impl ApplicationHandler for App { modifiers, ); if !seq.is_empty() { - pane.pty.write(&seq); - } + let _ = pane.pty.write(&seq); + } if button == MouseButton::Left { pane.is_selecting = pressed; } diff --git a/src/renderer.rs b/src/renderer.rs index d65a1d3..4ce2d39 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -198,6 +198,7 @@ enum SpriteTarget { } /// The terminal renderer. +#[allow(dead_code)] pub struct Renderer { surface: wgpu::Surface<'static>, device: wgpu::Device, @@ -2980,7 +2981,6 @@ impl Renderer { c, self.cell_metrics.cell_width as usize, self.cell_metrics.cell_height as usize, - self.font_size, self.dpi, ) { // Box-drawing bitmaps are already cell-sized and fill from top-left. diff --git a/src/terminal.rs b/src/terminal.rs index 83c346a..dc5aa9d 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -1318,7 +1318,6 @@ impl Handler for Terminal { // Look for patterns like "38;2;128" or "4;64;64m" - these are SGR parameters if codepoints.len() >= 3 { let has_semicolon = codepoints.iter().any(|&c| c == 0x3B); // ';' - let has_m = codepoints.iter().any(|&c| c == 0x6D); // 'm' let mostly_digits = codepoints .iter() .filter(|&&c| c >= 0x30 && c <= 0x39) diff --git a/src/vt_test_osc.rs b/src/vt_test_osc.rs index 6506f75..e2f9115 100644 --- a/src/vt_test_osc.rs +++ b/src/vt_test_osc.rs @@ -1,5 +1,6 @@ use crate::vt_parser::*; +#[allow(dead_code)] pub struct DummyHandler { pub text: String, pub osc_calls: Vec>,