fix build warnings
This commit is contained in:
@@ -106,7 +106,7 @@ struct TerminalState {
|
||||
/// SSE rate tracking for wave animation
|
||||
sse_wave_history: VecDeque<f64>, // Wave animation values for SSEs
|
||||
/// Start time for token tracking
|
||||
session_start: Instant,
|
||||
_session_start: Instant, // Prefixed with _ to indicate it's intentionally unused for now
|
||||
/// SSE counter (including pings)
|
||||
sse_count: u32,
|
||||
/// Last token count for rate calculation
|
||||
@@ -147,7 +147,7 @@ impl TerminalState {
|
||||
last_tool_header_index: None,
|
||||
token_wave_history: VecDeque::with_capacity(40), // Keep 40 points for wave animation
|
||||
sse_wave_history: VecDeque::with_capacity(40), // Keep 40 points for wave animation
|
||||
session_start: Instant::now(),
|
||||
_session_start: Instant::now(),
|
||||
last_token_count: 0,
|
||||
sse_count: 0,
|
||||
}
|
||||
@@ -459,18 +459,6 @@ impl TerminalState {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Add padding lines to ensure content can be scrolled fully into view
|
||||
fn add_padding(&mut self) {
|
||||
// Add enough blank lines to ensure the last content can be scrolled into view
|
||||
// This is a workaround for the scrolling calculation issues
|
||||
let padding_lines = 5; // Add 5 blank lines for padding
|
||||
for _ in 0..padding_lines {
|
||||
self.output_history.push(String::new());
|
||||
}
|
||||
// Reset scroll to show the actual content (not the padding)
|
||||
// This keeps the view focused on the last real content
|
||||
}
|
||||
}
|
||||
|
||||
/// Public interface for the retro terminal
|
||||
@@ -1571,43 +1559,6 @@ impl RetroTui {
|
||||
state.manual_scroll = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Scroll tool activity up
|
||||
pub fn tool_scroll_up(&self) {
|
||||
if let Ok(mut state) = self.state.lock() {
|
||||
if state.tool_activity_scroll > 0 {
|
||||
state.tool_activity_auto_scroll = false;
|
||||
state.tool_activity_scroll -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Scroll tool activity down
|
||||
pub fn tool_scroll_down(&self) {
|
||||
if let Ok(mut state) = self.state.lock() {
|
||||
let total_lines = state.tool_activity.len();
|
||||
let visible_height = 6; // Tool detail area height minus borders
|
||||
|
||||
if total_lines > visible_height {
|
||||
let max_scroll = total_lines.saturating_sub(visible_height);
|
||||
if state.tool_activity_scroll < max_scroll {
|
||||
state.tool_activity_auto_scroll = false;
|
||||
state.tool_activity_scroll = (state.tool_activity_scroll + 1).min(max_scroll);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Reset tool activity scroll to auto-scroll mode
|
||||
pub fn tool_scroll_auto(&self) {
|
||||
if let Ok(mut state) = self.state.lock() {
|
||||
state.tool_activity_auto_scroll = true;
|
||||
let visible_height = 6;
|
||||
if state.tool_activity.len() > visible_height {
|
||||
state.tool_activity_scroll = state.tool_activity.len().saturating_sub(visible_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for RetroTui {
|
||||
|
||||
@@ -87,13 +87,6 @@ impl ColorTheme {
|
||||
Ok(theme)
|
||||
}
|
||||
|
||||
/// Save a theme to a JSON file
|
||||
pub fn to_file<P: AsRef<Path>>(&self, path: P) -> Result<()> {
|
||||
let content = serde_json::to_string_pretty(self)?;
|
||||
fs::write(path, content)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get the default retro sci-fi theme (inspired by Alien terminals)
|
||||
pub fn default() -> Self {
|
||||
ColorTheme {
|
||||
@@ -151,41 +144,4 @@ impl ColorTheme {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Create example theme files in the user's config directory
|
||||
pub fn create_example_themes() -> Result<()> {
|
||||
let home = dirs::home_dir().ok_or_else(|| anyhow::anyhow!("Could not find home directory"))?;
|
||||
let themes_dir = home.join(".config").join("g3").join("themes");
|
||||
|
||||
// Create directory if it doesn't exist
|
||||
fs::create_dir_all(&themes_dir)?;
|
||||
|
||||
// Save default theme
|
||||
let default_theme = ColorTheme::default();
|
||||
default_theme.to_file(themes_dir.join("retro.json"))?;
|
||||
|
||||
// Save Dracula theme
|
||||
let dracula_theme = ColorTheme::dracula();
|
||||
dracula_theme.to_file(themes_dir.join("dracula.json"))?;
|
||||
|
||||
// Create a custom example theme (Matrix-inspired)
|
||||
let matrix_theme = ColorTheme {
|
||||
name: "Matrix".to_string(),
|
||||
terminal_green: ColorValue::Rgb { r: 0, g: 255, b: 0 },
|
||||
terminal_amber: ColorValue::Rgb { r: 0, g: 200, b: 0 },
|
||||
terminal_dim_green: ColorValue::Rgb { r: 0, g: 100, b: 0 },
|
||||
terminal_bg: ColorValue::Rgb { r: 0, g: 0, b: 0 },
|
||||
terminal_cyan: ColorValue::Rgb { r: 0, g: 255, b: 128 },
|
||||
terminal_red: ColorValue::Rgb { r: 255, g: 0, b: 0 },
|
||||
terminal_pale_blue: ColorValue::Rgb { r: 0, g: 255, b: 200 },
|
||||
terminal_dark_amber: ColorValue::Rgb { r: 0, g: 150, b: 0 },
|
||||
terminal_white: ColorValue::Rgb { r: 200, g: 255, b: 200 },
|
||||
terminal_success: ColorValue::Rgb { r: 0, g: 255, b: 0 }, // Bright green for Matrix theme
|
||||
};
|
||||
matrix_theme.to_file(themes_dir.join("matrix.json"))?;
|
||||
|
||||
println!("Example theme files created in: {}", themes_dir.display());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user