diff --git a/src/main.rs b/src/main.rs
index 366f450..a4a3bca 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -89,9 +89,9 @@ fn main() -> Result<()> {
last_opened: Utc::now(),
});
}
- opts::Commands::Recent { focus } => {
+ opts::Commands::Recent => {
// Get workspace from user selection
- let res = ui::start(&mut tracker, focus)?;
+ let res = ui::start(&mut tracker)?;
if let Some(entry) = res {
let ws = Workspace::from_path(&entry.workspace_path)?;
let ws_name = ws.name.clone();
diff --git a/src/opts.rs b/src/opts.rs
index 6743464..065f814 100644
--- a/src/opts.rs
+++ b/src/opts.rs
@@ -2,7 +2,7 @@ use std::{ffi::OsString, path::PathBuf};
use clap::{command, Parser, Subcommand};
-use crate::{launch::ContainerStrategy, ui::Focus};
+use crate::launch::ContainerStrategy;
/// Main CLI arguments
#[derive(Parser, Debug)]
@@ -58,8 +58,5 @@ pub(crate) enum Commands {
},
/// Opens an interactive list of recently used workspaces.
#[clap(alias = "ui")]
- Recent {
- #[arg(value_enum, short, long, default_value_t = Focus::Select, ignore_case = true)]
- focus: Focus,
- },
+ Recent,
}
diff --git a/src/ui.rs b/src/ui.rs
index 46b7241..1d250ca 100644
--- a/src/ui.rs
+++ b/src/ui.rs
@@ -1,7 +1,8 @@
-use clap::ValueEnum;
use color_eyre::eyre::Result;
use crossterm::{
- event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyEventKind},
+ event::{
+ self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyEventKind, KeyModifiers,
+ },
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
};
@@ -17,18 +18,11 @@ use ratatui::{
Frame, Terminal,
};
use std::{borrow::Cow, io, rc::Rc};
-use tui_textarea::{Input, Key, TextArea};
+use tui_textarea::TextArea;
use uuid::Uuid;
use crate::history::{Entry, History, Tracker};
-/// Indicates which component is currently focused by the UI.
-#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
-pub enum Focus {
- Search,
- Select,
-}
-
/// All "user triggered" action which the app might want to perform.
#[derive(Debug, Clone, PartialEq, Eq)]
enum AppAction {
@@ -39,7 +33,6 @@ enum AppAction {
SelectLast,
OpenSelected,
DeleteSelectedEntry,
- CycleFocus,
SearchInput(tui_textarea::Input),
}
@@ -188,7 +181,6 @@ impl TableData {
/// The UI state
struct UI<'a> {
- focus: Focus,
search: TextArea<'a>,
table_state: TableState,
table_data: TableData,
@@ -196,9 +188,8 @@ struct UI<'a> {
impl<'a> UI<'a> {
/// Create new empty state from history tracker reference
- pub fn new(history: &History, focus: Focus) -> UI<'a> {
+ pub fn new(history: &History) -> UI<'a> {
UI {
- focus,
search: TextArea::default(),
table_state: TableState::default(),
table_data: TableData::from_iter(history.iter().cloned()),
@@ -299,7 +290,7 @@ impl<'a> UI<'a> {
}
/// Starts the UI and returns the selected/resulting entry
-pub(crate) fn start(tracker: &mut Tracker, focus: Focus) -> Result