mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-03 18:30:41 +08:00
Do not quit on new issue form
This commit is contained in:
+6
-2
@@ -11,7 +11,7 @@ use radicle::profile::Profile;
|
||||
|
||||
use radicle_tui::ui::widget;
|
||||
use tuirealm::application::PollStrategy;
|
||||
use tuirealm::{Application, Frame, NoUserEvent};
|
||||
use tuirealm::{Application, Frame, NoUserEvent, Sub, SubClause};
|
||||
|
||||
use radicle_tui::ui::context::Context;
|
||||
use radicle_tui::ui::theme::{self, Theme};
|
||||
@@ -288,7 +288,11 @@ impl Tui<Cid, Message> for App {
|
||||
|
||||
// Add global key listener and subscribe to key events
|
||||
let global = ui::widget::common::global_listener().to_boxed();
|
||||
app.mount(Cid::GlobalListener, global, subscription::global())?;
|
||||
app.mount(
|
||||
Cid::GlobalListener,
|
||||
global,
|
||||
vec![Sub::new(subscription::global_clause(), SubClause::Always)],
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -478,6 +478,8 @@ impl ViewPage for IssuePage {
|
||||
app.remount(Cid::Issue(cid.clone()), new_form, vec![])?;
|
||||
app.active(&Cid::Issue(cid.clone()))?;
|
||||
|
||||
app.unsubscribe(&Cid::GlobalListener, subscription::global_clause())?;
|
||||
|
||||
self.update_shortcuts(app, cid)?;
|
||||
}
|
||||
}
|
||||
@@ -485,6 +487,11 @@ impl ViewPage for IssuePage {
|
||||
app.blur()?;
|
||||
app.umount(&Cid::Issue(cid))?;
|
||||
|
||||
app.subscribe(
|
||||
&Cid::GlobalListener,
|
||||
Sub::new(subscription::global_clause(), SubClause::Always),
|
||||
)?;
|
||||
|
||||
self.update_shortcuts(app, IssueCid::List)?;
|
||||
}
|
||||
_ => {}
|
||||
|
||||
+6
-15
@@ -1,7 +1,5 @@
|
||||
use std::hash::Hash;
|
||||
|
||||
use tuirealm::event::{Key, KeyEvent, KeyModifiers};
|
||||
use tuirealm::{Sub, SubClause, SubEventClause};
|
||||
use tuirealm::SubEventClause;
|
||||
|
||||
pub fn navigation_clause<UserEvent>() -> SubEventClause<UserEvent>
|
||||
where
|
||||
@@ -13,19 +11,12 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
pub fn global<Id, UserEvent>() -> Vec<Sub<Id, UserEvent>>
|
||||
pub fn global_clause<UserEvent>() -> SubEventClause<UserEvent>
|
||||
where
|
||||
Id: Clone + Hash + Eq + PartialEq,
|
||||
UserEvent: Clone + Eq + PartialEq + PartialOrd,
|
||||
{
|
||||
vec![
|
||||
Sub::new(
|
||||
SubEventClause::Keyboard(KeyEvent {
|
||||
code: Key::Char('q'),
|
||||
modifiers: KeyModifiers::NONE,
|
||||
}),
|
||||
SubClause::Always,
|
||||
),
|
||||
Sub::new(SubEventClause::WindowResize, SubClause::Always),
|
||||
]
|
||||
SubEventClause::Keyboard(KeyEvent {
|
||||
code: Key::Char('q'),
|
||||
modifiers: KeyModifiers::NONE,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user