fix compiler warning
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -521,7 +521,6 @@ pub fn render_box_char(
|
||||
c: char,
|
||||
cell_width: usize,
|
||||
cell_height: usize,
|
||||
font_size: f32,
|
||||
dpi: f64,
|
||||
) -> Option<(Vec<u8>, bool)> {
|
||||
let w = cell_width;
|
||||
|
||||
+12
-65
@@ -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<PaneGeometry> {
|
||||
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<UserEvent> for App {
|
||||
modifiers,
|
||||
);
|
||||
if !seq.is_empty() {
|
||||
pane.pty.write(&seq);
|
||||
let _ = pane.pty.write(&seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3202,7 +3149,7 @@ impl ApplicationHandler<UserEvent> for App {
|
||||
modifiers,
|
||||
);
|
||||
if !seq.is_empty() {
|
||||
pane.pty.write(&seq);
|
||||
let _ = pane.pty.write(&seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3418,8 +3365,8 @@ impl ApplicationHandler<UserEvent> for App {
|
||||
modifiers,
|
||||
);
|
||||
if !seq.is_empty() {
|
||||
pane.pty.write(&seq);
|
||||
}
|
||||
let _ = pane.pty.write(&seq);
|
||||
}
|
||||
if button == MouseButton::Left {
|
||||
pane.is_selecting = pressed;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use crate::vt_parser::*;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct DummyHandler {
|
||||
pub text: String,
|
||||
pub osc_calls: Vec<Vec<u8>>,
|
||||
|
||||
Reference in New Issue
Block a user