mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-05 21:28:48 +00:00
Moved preview_content to floating_text and merged
This commit is contained in:
parent
ab2cc1340f
commit
da7f078063
|
@ -1,8 +1,6 @@
|
||||||
use crossterm::event::{KeyCode, KeyEvent};
|
use crossterm::event::{KeyCode, KeyEvent};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
layout::{Constraint, Direction, Layout, Rect},
|
layout::{Constraint, Direction, Layout, Rect},
|
||||||
style::{Color, Style, Stylize},
|
|
||||||
widgets::Block,
|
|
||||||
Frame,
|
Frame,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
use crate::{
|
use crate::{float::Float, floating_text::FloatingText, running_command::Command, state::AppState};
|
||||||
float::Float, preview_content::FloatingText, running_command::Command, state::AppState,
|
|
||||||
};
|
|
||||||
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind};
|
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind};
|
||||||
use ego_tree::{tree, NodeId};
|
use ego_tree::{tree, NodeId};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -1,6 +1,6 @@
|
||||||
mod float;
|
mod float;
|
||||||
|
mod floating_text;
|
||||||
mod list;
|
mod list;
|
||||||
mod preview_content;
|
|
||||||
mod running_command;
|
mod running_command;
|
||||||
pub mod state;
|
pub mod state;
|
||||||
mod theme;
|
mod theme;
|
||||||
|
@ -140,11 +140,11 @@ fn run<B: Backend>(terminal: &mut Terminal<B>, state: &AppState) -> io::Result<(
|
||||||
if key.kind != KeyEventKind::Press && key.kind != KeyEventKind::Repeat {
|
if key.kind != KeyEventKind::Press && key.kind != KeyEventKind::Repeat {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if let Some(ref mut command) = command_opt {
|
|
||||||
if command.handle_key_event(&key) {
|
//Send the key to the float
|
||||||
command_opt = None;
|
//If we receive true, then the float processed the input
|
||||||
}
|
//If that's the case, don't propagate input to other widgets
|
||||||
} else {
|
if !command_float.handle_key_event(&key) {
|
||||||
//Insert user input into the search bar
|
//Insert user input into the search bar
|
||||||
if in_search_mode {
|
if in_search_mode {
|
||||||
match key.code {
|
match key.code {
|
||||||
|
@ -168,7 +168,7 @@ fn run<B: Backend>(terminal: &mut Terminal<B>, state: &AppState) -> io::Result<(
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
} else if let Some(cmd) = custom_list.handle_key(key, state) {
|
} else if let Some(cmd) = custom_list.handle_key(key, state) {
|
||||||
command_opt = Some(RunningCommand::new(cmd, state));
|
command_float.set_content(Some(RunningCommand::new(cmd, state)));
|
||||||
} else {
|
} else {
|
||||||
// Handle keys while not in search mode
|
// Handle keys while not in search mode
|
||||||
match key.code {
|
match key.code {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user