Radish alpha
r
rad:z39mP9rQAaGmERfUMPULfPUi473tY
Radicle terminal user interface
Radicle
Git
issue/list: Fix wrong events being sent globally
Erik Kundt committed 4 months ago
commit 27a96ab61ea6ba646e0e0401ee61b8a6d1351eab
parent ca78590
3 files changed +26 -12
modified bin/commands/issue.rs
@@ -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 {
modified bin/commands/issue/list.rs
@@ -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
modified bin/commands/issue/list/ui.rs
@@ -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;