Merge pull request #55 from adamperkowski/main

Add formatting fixes and remove dead code
This commit is contained in:
Chris Titus 2024-07-23 21:44:55 -05:00 committed by GitHub
commit 7125cac196
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 10 deletions

Binary file not shown.

View File

@ -1,5 +1,3 @@
use std::usize;
use crate::{float::floating_window, theme::*};
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind};
use ego_tree::{tree, NodeId};
@ -169,7 +167,10 @@ impl CustomList {
// node
let list = List::new(items)
.highlight_style(Style::default().reversed())
.block(Block::default().borders(Borders::ALL).title(format!("Linux Toolbox - {}", chrono::Local::now().format("%Y-%m-%d"))))
.block(Block::default().borders(Borders::ALL).title(format!(
"Linux Toolbox - {}",
chrono::Local::now().format("%Y-%m-%d")
)))
.scroll_padding(1);
// Render it
@ -251,7 +252,7 @@ impl CustomList {
// Get the selected command
if let Some(selected_command) = self.get_selected_command() {
// If command is a folder, we don't display a preview
if selected_command == "" {
if selected_command.is_empty() {
return;
}
@ -383,4 +384,4 @@ impl CustomList {
fn at_root(&self) -> bool {
self.visit_stack.len() == 1
}
}
}

View File

@ -95,6 +95,5 @@ fn run<B: Backend>(terminal: &mut Terminal<B>) -> io::Result<()> {
}
}
}
}
}

View File

@ -30,7 +30,7 @@ pub struct RunningCommand {
buffer: Arc<Mutex<Vec<u8>>>,
/// A handle of the tread where the command is being executed
command_thread: Option<JoinHandle<ExitStatus>>,
command_thread: Option<JoinHandle<ExitStatus>>,
/// A handle to kill the running process, it's an option because it can only be used once
child_killer: Option<Receiver<Box<dyn ChildKiller + Send + Sync>>>,
@ -279,4 +279,4 @@ impl RunningCommand {
// Send the keycodes to the virtual terminal
let _ = self.writer.write_all(&input_bytes);
}
}
}

View File

@ -31,9 +31,9 @@ pub const THEMES: [Theme; 2] = [
];
pub fn get_theme() -> &'static Theme {
&THEMES[unsafe { THEME_IDX } ]
&THEMES[unsafe { THEME_IDX }]
}
pub fn set_theme(idx: usize){
pub fn set_theme(idx: usize) {
unsafe { THEME_IDX = idx };
}