mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-07 12:05:34 +00:00
feat(ux): print current query to stdout on Enter if no entry is selected (#151)
Fixes #49
This commit is contained in:
parent
12fdf94e5d
commit
c3b8c68d1b
@ -45,6 +45,7 @@ pub struct App {
|
||||
#[derive(Debug)]
|
||||
pub enum ActionOutcome {
|
||||
Entry(Entry),
|
||||
Input(String),
|
||||
Passthrough(Entry, String),
|
||||
None,
|
||||
}
|
||||
@ -63,6 +64,10 @@ impl From<ActionOutcome> for AppOutput {
|
||||
selected_entry: Some(entry),
|
||||
passthrough: None,
|
||||
},
|
||||
ActionOutcome::Input(input) => Self {
|
||||
selected_entry: None,
|
||||
passthrough: Some(input),
|
||||
},
|
||||
ActionOutcome::Passthrough(entry, key) => Self {
|
||||
selected_entry: Some(entry),
|
||||
passthrough: Some(key),
|
||||
@ -261,7 +266,9 @@ impl App {
|
||||
{
|
||||
return Ok(ActionOutcome::Entry(entry));
|
||||
}
|
||||
return Ok(ActionOutcome::None);
|
||||
return Ok(ActionOutcome::Input(
|
||||
self.television.lock().await.current_pattern.clone(),
|
||||
));
|
||||
}
|
||||
Action::SelectPassthrough(passthrough) => {
|
||||
self.should_quit = true;
|
||||
|
@ -38,7 +38,7 @@ pub struct Television {
|
||||
pub(crate) channel: TelevisionChannel,
|
||||
pub(crate) remote_control: TelevisionChannel,
|
||||
pub mode: Mode,
|
||||
current_pattern: String,
|
||||
pub current_pattern: String,
|
||||
pub(crate) results_picker: Picker,
|
||||
pub(crate) rc_picker: Picker,
|
||||
results_area_height: u32,
|
||||
@ -358,6 +358,11 @@ impl Television {
|
||||
self.change_channel(new_channel);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.action_tx
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.send(Action::SelectAndExit)?;
|
||||
}
|
||||
}
|
||||
Action::CopyEntryToClipboard => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user