issue/list: Fix wrong events being sent globally

This commit is contained in:
Erik Kundt
2025-12-24 01:10:19 +01:00
parent ca78590c81
commit 27a96ab61e
3 changed files with 26 additions and 12 deletions
+2 -2
View File
@@ -244,8 +244,8 @@ pub async fn run(options: Options, ctx: impl Context) -> anyhow::Result<()> {
IssueOperation::Edit { id } => {
terminal::run_rad(
Some("issue"),
&["edit".into(), id.to_string().into()],
Quiet::Yes,
&["edit".into(), id.to_string().into(), "--quiet".into()],
Quiet::No,
)?;
}
IssueOperation::Comment {
+18 -10
View File
@@ -514,16 +514,24 @@ fn browser(channel: &Channel<Message>) -> Widget<State, Message> {
Browser::new(tx.clone())
.to_widget(tx.clone())
.on_update(|state| BrowserProps::from(state).to_boxed_any().into())
.on_event(|event, _, _| {
if let Event::Key(key) = event {
match key {
Key::Enter => Some(Message::Exit {
operation: Some(RequestedIssueOperation::Show),
}),
Key::Char('e') => Some(Message::Exit {
operation: Some(RequestedIssueOperation::Edit),
}),
_ => None,
.on_event(|event, _, props| {
let default = BrowserProps::default();
let props = props
.and_then(|props| props.inner_ref::<BrowserProps>())
.unwrap_or(&default);
if !props.show_search() {
if let Event::Key(key) = event {
match key {
Key::Enter => Some(Message::Exit {
operation: Some(RequestedIssueOperation::Show),
}),
Key::Char('e') => Some(Message::Exit {
operation: Some(RequestedIssueOperation::Edit),
}),
_ => None,
}
} else {
None
}
} else {
None
+6
View File
@@ -49,6 +49,12 @@ pub struct BrowserProps<'a> {
search: String,
}
impl<'a> BrowserProps<'a> {
pub fn show_search(&self) -> bool {
self.show_search
}
}
impl From<&State> for BrowserProps<'_> {
fn from(state: &State) -> Self {
use radicle::issue::State;