mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-08 04:25:23 +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)]
|
#[derive(Debug)]
|
||||||
pub enum ActionOutcome {
|
pub enum ActionOutcome {
|
||||||
Entry(Entry),
|
Entry(Entry),
|
||||||
|
Input(String),
|
||||||
Passthrough(Entry, String),
|
Passthrough(Entry, String),
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
@ -63,6 +64,10 @@ impl From<ActionOutcome> for AppOutput {
|
|||||||
selected_entry: Some(entry),
|
selected_entry: Some(entry),
|
||||||
passthrough: None,
|
passthrough: None,
|
||||||
},
|
},
|
||||||
|
ActionOutcome::Input(input) => Self {
|
||||||
|
selected_entry: None,
|
||||||
|
passthrough: Some(input),
|
||||||
|
},
|
||||||
ActionOutcome::Passthrough(entry, key) => Self {
|
ActionOutcome::Passthrough(entry, key) => Self {
|
||||||
selected_entry: Some(entry),
|
selected_entry: Some(entry),
|
||||||
passthrough: Some(key),
|
passthrough: Some(key),
|
||||||
@ -261,7 +266,9 @@ impl App {
|
|||||||
{
|
{
|
||||||
return Ok(ActionOutcome::Entry(entry));
|
return Ok(ActionOutcome::Entry(entry));
|
||||||
}
|
}
|
||||||
return Ok(ActionOutcome::None);
|
return Ok(ActionOutcome::Input(
|
||||||
|
self.television.lock().await.current_pattern.clone(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
Action::SelectPassthrough(passthrough) => {
|
Action::SelectPassthrough(passthrough) => {
|
||||||
self.should_quit = true;
|
self.should_quit = true;
|
||||||
|
@ -38,7 +38,7 @@ pub struct Television {
|
|||||||
pub(crate) channel: TelevisionChannel,
|
pub(crate) channel: TelevisionChannel,
|
||||||
pub(crate) remote_control: TelevisionChannel,
|
pub(crate) remote_control: TelevisionChannel,
|
||||||
pub mode: Mode,
|
pub mode: Mode,
|
||||||
current_pattern: String,
|
pub current_pattern: String,
|
||||||
pub(crate) results_picker: Picker,
|
pub(crate) results_picker: Picker,
|
||||||
pub(crate) rc_picker: Picker,
|
pub(crate) rc_picker: Picker,
|
||||||
results_area_height: u32,
|
results_area_height: u32,
|
||||||
@ -358,6 +358,11 @@ impl Television {
|
|||||||
self.change_channel(new_channel);
|
self.change_channel(new_channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
self.action_tx
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.send(Action::SelectAndExit)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Action::CopyEntryToClipboard => {
|
Action::CopyEntryToClipboard => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user