mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-22 05:12:27 +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 ratatui::{
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
style::{Color, Style, Stylize},
|
||||
widgets::Block,
|
||||
Frame,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
use crate::{
|
||||
float::Float, preview_content::FloatingText, running_command::Command, state::AppState,
|
||||
};
|
||||
use crate::{float::Float, floating_text::FloatingText, running_command::Command, state::AppState};
|
||||
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind};
|
||||
use ego_tree::{tree, NodeId};
|
||||
use ratatui::{
|
||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -1,6 +1,6 @@
|
|||
mod float;
|
||||
mod floating_text;
|
||||
mod list;
|
||||
mod preview_content;
|
||||
mod running_command;
|
||||
pub mod state;
|
||||
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 {
|
||||
continue;
|
||||
}
|
||||
if let Some(ref mut command) = command_opt {
|
||||
if command.handle_key_event(&key) {
|
||||
command_opt = None;
|
||||
}
|
||||
} else {
|
||||
|
||||
//Send the key to the float
|
||||
//If we receive true, then the float processed the input
|
||||
//If that's the case, don't propagate input to other widgets
|
||||
if !command_float.handle_key_event(&key) {
|
||||
//Insert user input into the search bar
|
||||
if in_search_mode {
|
||||
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) {
|
||||
command_opt = Some(RunningCommand::new(cmd, state));
|
||||
command_float.set_content(Some(RunningCommand::new(cmd, state)));
|
||||
} else {
|
||||
// Handle keys while not in search mode
|
||||
match key.code {
|
||||
|
|
Loading…
Reference in New Issue
Block a user