fix compiler warning
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
use zterm::terminal::Terminal;
|
use zterm::terminal::Terminal;
|
||||||
use zterm::vt_parser::Parser;
|
use zterm::vt_parser::Parser;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use std::io::Write;
|
|
||||||
|
|
||||||
const ASCII_PRINTABLE: &[u8] = b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ `~!@#$%^&*()_+-=[]{}\\|;:'\",<.>/?";
|
const ASCII_PRINTABLE: &[u8] = b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ `~!@#$%^&*()_+-=[]{}\\|;:'\",<.>/?";
|
||||||
const CONTROL_CHARS: &[u8] = b"\n\t";
|
const CONTROL_CHARS: &[u8] = b"\n\t";
|
||||||
|
|||||||
@@ -521,7 +521,6 @@ pub fn render_box_char(
|
|||||||
c: char,
|
c: char,
|
||||||
cell_width: usize,
|
cell_width: usize,
|
||||||
cell_height: usize,
|
cell_height: usize,
|
||||||
font_size: f32,
|
|
||||||
dpi: f64,
|
dpi: f64,
|
||||||
) -> Option<(Vec<u8>, bool)> {
|
) -> Option<(Vec<u8>, bool)> {
|
||||||
let w = cell_width;
|
let w = cell_width;
|
||||||
|
|||||||
+12
-65
@@ -174,7 +174,7 @@ impl Pane {
|
|||||||
/// Calculate the current dim factor based on animation progress.
|
/// Calculate the current dim factor based on animation progress.
|
||||||
/// Returns a value between `inactive_dim` (for unfocused) and 1.0 (for focused).
|
/// 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.
|
/// 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 {
|
if fade_duration_ms == 0 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -710,8 +710,9 @@ impl Tab {
|
|||||||
self.panes.get(&self.active_pane)
|
self.panes.get(&self.active_pane)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the active pane mutably.
|
/// Get the active pane mutably.
|
||||||
fn active_pane_mut(&mut self) -> Option<&mut Pane> {
|
#[allow(dead_code)]
|
||||||
|
fn active_pane_mut(&mut self) -> Option<&mut Pane> {
|
||||||
self.panes.get_mut(&self.active_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 last_tick_at = std::time::Instant::now();
|
||||||
let mut has_pending_data = false;
|
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) {
|
while !shutdown.load(Ordering::Relaxed) {
|
||||||
events.clear();
|
events.clear();
|
||||||
loop_count += 1;
|
|
||||||
|
|
||||||
// Check if we have space - if not, disable PTY polling until woken
|
// Check if we have space - if not, disable PTY polling until woken
|
||||||
let has_space = shared_parser.has_space();
|
let has_space = shared_parser.has_space();
|
||||||
@@ -1736,7 +1731,6 @@ impl App {
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
bytes_this_loop += result as i64;
|
bytes_this_loop += result as i64;
|
||||||
total_bytes_read += result as u64;
|
|
||||||
has_pending_data = true;
|
has_pending_data = true;
|
||||||
// Check if buffer became full
|
// Check if buffer became full
|
||||||
if !shared_parser.has_space() {
|
if !shared_parser.has_space() {
|
||||||
@@ -1872,6 +1866,7 @@ impl App {
|
|||||||
/// 2. Parsing happens in-place - no copying data out of buffer
|
/// 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
|
/// 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
|
/// 4. Loop continues parsing as long as time budget allows
|
||||||
|
#[allow(unused_assignments)]
|
||||||
fn poll_pane(&mut self, pane_id: PaneId) -> (bool, bool) {
|
fn poll_pane(&mut self, pane_id: PaneId) -> (bool, bool) {
|
||||||
let mut ever_processed = false;
|
let mut ever_processed = false;
|
||||||
let mut all_commands = Vec::new();
|
let mut all_commands = Vec::new();
|
||||||
@@ -2022,8 +2017,7 @@ impl App {
|
|||||||
tab.panes
|
tab.panes
|
||||||
.get(pane_id)
|
.get(pane_id)
|
||||||
.map(|p| {
|
.map(|p| {
|
||||||
let is_active = *pane_id == active_pane_id;
|
p.is_fade_in_progress(fade_duration_ms)
|
||||||
p.is_fade_in_progress(fade_duration_ms, is_active)
|
|
||||||
})
|
})
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
});
|
});
|
||||||
@@ -2186,8 +2180,7 @@ impl App {
|
|||||||
tab.panes
|
tab.panes
|
||||||
.get(pane_id)
|
.get(pane_id)
|
||||||
.map(|p| {
|
.map(|p| {
|
||||||
let is_active = *pane_id == active_pane_id;
|
p.is_fade_in_progress(fade_duration_ms)
|
||||||
p.is_fade_in_progress(fade_duration_ms, is_active)
|
|
||||||
})
|
})
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
});
|
});
|
||||||
@@ -2248,6 +2241,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get the active pane of the active tab mutably, if any.
|
/// Get the active pane of the active tab mutably, if any.
|
||||||
|
#[allow(dead_code)]
|
||||||
fn active_pane_mut(&mut self) -> Option<&mut Pane> {
|
fn active_pane_mut(&mut self) -> Option<&mut Pane> {
|
||||||
self.active_tab_mut().and_then(|t| t.active_pane_mut())
|
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 {
|
fn has_mouse_tracking_for_pane(&self, pane_id: PaneId) -> bool {
|
||||||
self.active_tab()
|
self.active_tab()
|
||||||
.and_then(|t| t.panes.get(&pane_id))
|
.and_then(|t| t.panes.get(&pane_id))
|
||||||
@@ -2289,12 +2271,6 @@ impl App {
|
|||||||
.unwrap_or(false)
|
.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 {
|
fn get_mouse_modifiers(&self) -> u8 {
|
||||||
let mod_state = self.modifiers.state();
|
let mod_state = self.modifiers.state();
|
||||||
let mut mods = 0u8;
|
let mut mods = 0u8;
|
||||||
@@ -2310,35 +2286,6 @@ impl App {
|
|||||||
mods
|
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 {
|
fn check_keybinding(&mut self, event: &KeyEvent) -> bool {
|
||||||
if event.state != ElementState::Pressed || event.repeat {
|
if event.state != ElementState::Pressed || event.repeat {
|
||||||
return false;
|
return false;
|
||||||
@@ -3125,7 +3072,7 @@ impl ApplicationHandler<UserEvent> for App {
|
|||||||
modifiers,
|
modifiers,
|
||||||
);
|
);
|
||||||
if !seq.is_empty() {
|
if !seq.is_empty() {
|
||||||
pane.pty.write(&seq);
|
let _ = pane.pty.write(&seq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3202,7 +3149,7 @@ impl ApplicationHandler<UserEvent> for App {
|
|||||||
modifiers,
|
modifiers,
|
||||||
);
|
);
|
||||||
if !seq.is_empty() {
|
if !seq.is_empty() {
|
||||||
pane.pty.write(&seq);
|
let _ = pane.pty.write(&seq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3418,8 +3365,8 @@ impl ApplicationHandler<UserEvent> for App {
|
|||||||
modifiers,
|
modifiers,
|
||||||
);
|
);
|
||||||
if !seq.is_empty() {
|
if !seq.is_empty() {
|
||||||
pane.pty.write(&seq);
|
let _ = pane.pty.write(&seq);
|
||||||
}
|
}
|
||||||
if button == MouseButton::Left {
|
if button == MouseButton::Left {
|
||||||
pane.is_selecting = pressed;
|
pane.is_selecting = pressed;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -198,6 +198,7 @@ enum SpriteTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The terminal renderer.
|
/// The terminal renderer.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub struct Renderer {
|
pub struct Renderer {
|
||||||
surface: wgpu::Surface<'static>,
|
surface: wgpu::Surface<'static>,
|
||||||
device: wgpu::Device,
|
device: wgpu::Device,
|
||||||
@@ -2980,7 +2981,6 @@ impl Renderer {
|
|||||||
c,
|
c,
|
||||||
self.cell_metrics.cell_width as usize,
|
self.cell_metrics.cell_width as usize,
|
||||||
self.cell_metrics.cell_height as usize,
|
self.cell_metrics.cell_height as usize,
|
||||||
self.font_size,
|
|
||||||
self.dpi,
|
self.dpi,
|
||||||
) {
|
) {
|
||||||
// Box-drawing bitmaps are already cell-sized and fill from top-left.
|
// 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
|
// Look for patterns like "38;2;128" or "4;64;64m" - these are SGR parameters
|
||||||
if codepoints.len() >= 3 {
|
if codepoints.len() >= 3 {
|
||||||
let has_semicolon = codepoints.iter().any(|&c| c == 0x3B); // ';'
|
let has_semicolon = codepoints.iter().any(|&c| c == 0x3B); // ';'
|
||||||
let has_m = codepoints.iter().any(|&c| c == 0x6D); // 'm'
|
|
||||||
let mostly_digits = codepoints
|
let mostly_digits = codepoints
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|&&c| c >= 0x30 && c <= 0x39)
|
.filter(|&&c| c >= 0x30 && c <= 0x39)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
use crate::vt_parser::*;
|
use crate::vt_parser::*;
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub struct DummyHandler {
|
pub struct DummyHandler {
|
||||||
pub text: String,
|
pub text: String,
|
||||||
pub osc_calls: Vec<Vec<u8>>,
|
pub osc_calls: Vec<Vec<u8>>,
|
||||||
|
|||||||
Reference in New Issue
Block a user