aboutsummaryrefslogtreecommitdiff
path: root/src/tui/popup.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tui/popup.rs')
-rw-r--r--src/tui/popup.rs49
1 files changed, 5 insertions, 44 deletions
diff --git a/src/tui/popup.rs b/src/tui/popup.rs
index fe76956..9011a3b 100644
--- a/src/tui/popup.rs
+++ b/src/tui/popup.rs
@@ -30,7 +30,7 @@ pub enum PopupKind {
Selection,
}
-#[derive(Debug)]
+#[derive(Debug, Default)]
pub struct PopupArea {
pub is_popup: bool,
pub popup_kind: Option<PopupKind>,
@@ -40,19 +40,6 @@ pub struct PopupArea {
pub popup_state: ListState,
}
-impl Default for PopupArea {
- fn default() -> Self {
- PopupArea {
- is_popup: false,
- popup_kind: None,
- popup_message: String::new(),
- popup_scroll_pos: 0,
- popup_list: Vec::new(),
- popup_state: ListState::default(),
- }
- }
-}
-
impl PopupArea {
pub fn popup_help<'a>() -> Text<'a> {
let help = [
@@ -78,36 +65,11 @@ impl PopupArea {
("ENTER: ", "Filter by selected keyword"),
("Search", "sub"),
("↓,↑,←,→: ", "Move cursor"),
+ ("BACKSPACE: ", "Delete Character"),
("ENTER: ", "Confirm search"),
("ESC: ", "Abort search"),
];
- // let help_text: Vec<Line<'_>> = help
- // .into_iter()
- // .map(|(keys, help)| {
- // if help == "first" {
- // Line::from(
- // Span::raw(keys)
- // .bold()
- // .fg(Color::Indexed(MAIN_BLUE_COLOR_INDEX)),
- // )
- // } else if help == "sub" {
- // Line::from(
- // Span::raw(keys)
- // .bold()
- // .fg(Color::Indexed(MAIN_BLUE_COLOR_INDEX)),
- // )
- // } else {
- // Line::from(vec![
- // Span::raw(keys)
- // .bold()
- // .fg(Color::Indexed(MAIN_PURPLE_COLOR_INDEX)),
- // Span::raw(help),
- // ])
- // }
- // })
- // .collect();
-
let mut helptext: Vec<Line<'_>> = vec![];
for (keys, help) in help {
@@ -134,13 +96,12 @@ impl PopupArea {
}
}
- let text = Text::from(helptext);
- text
+ Text::from(helptext)
}
- pub fn popup_message(&mut self, message: &str, object: String) {
+ pub fn popup_message(&mut self, message: String, object: String) {
if object.is_empty() {
- self.popup_message = message.into();
+ self.popup_message = message;
} else {
self.popup_message = format!("{} \"{}\"", message, object);
}