mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-22 05:12:27 +00:00
Made main.rs use new float logic
This commit is contained in:
parent
72c10c5ef8
commit
6e0540c68a
15
src/main.rs
15
src/main.rs
|
@ -1,5 +1,6 @@
|
||||||
mod float;
|
mod float;
|
||||||
mod list;
|
mod list;
|
||||||
|
mod preview_content;
|
||||||
mod running_command;
|
mod running_command;
|
||||||
pub mod state;
|
pub mod state;
|
||||||
mod theme;
|
mod theme;
|
||||||
|
@ -17,6 +18,7 @@ use crossterm::{
|
||||||
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
||||||
ExecutableCommand,
|
ExecutableCommand,
|
||||||
};
|
};
|
||||||
|
use float::Float;
|
||||||
use include_dir::include_dir;
|
use include_dir::include_dir;
|
||||||
use list::CustomList;
|
use list::CustomList;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
@ -77,9 +79,12 @@ fn main() -> std::io::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run<B: Backend>(terminal: &mut Terminal<B>, state: &AppState) -> io::Result<()> {
|
fn run<B: Backend>(terminal: &mut Terminal<B>, state: &AppState) -> io::Result<()> {
|
||||||
let mut command_opt: Option<RunningCommand> = None;
|
//Create the search field
|
||||||
let mut custom_list = CustomList::new();
|
|
||||||
let mut search_input = String::new();
|
let mut search_input = String::new();
|
||||||
|
//Create the command list
|
||||||
|
let mut custom_list = CustomList::new();
|
||||||
|
//Create the float to hold command output
|
||||||
|
let mut command_float = Float::new(60, 60);
|
||||||
let mut in_search_mode = false;
|
let mut in_search_mode = false;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
@ -118,10 +123,8 @@ fn run<B: Backend>(terminal: &mut Terminal<B>, state: &AppState) -> io::Result<(
|
||||||
frame.render_widget(search_bar, chunks[0]);
|
frame.render_widget(search_bar, chunks[0]);
|
||||||
//Render the command list (Second chunk of the screen)
|
//Render the command list (Second chunk of the screen)
|
||||||
custom_list.draw(frame, chunks[1], state);
|
custom_list.draw(frame, chunks[1], state);
|
||||||
|
//Render the command float in the custom_list chunk
|
||||||
if let Some(ref mut command) = &mut command_opt {
|
command_float.draw(frame, chunks[1]);
|
||||||
command.draw(frame, state);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user