summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoscha <joscha@plugh.de>2022-08-30 03:05:37 +0200
committerJoscha <joscha@plugh.de>2022-08-30 03:05:37 +0200
commita091855ea3ee0c6d39fff8b5803820c31c43fef3 (patch)
treebbc86fbfcb3a62117c72328ddeb4959757430bd1
parent9c3f846d8acfe3880fdd0c6b5d91e567ffa97429 (diff)
Fix links key binding masking editor key bindings
-rw-r--r--src/ui/euph/room.rs35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/ui/euph/room.rs b/src/ui/euph/room.rs
index 3395205..7db984d 100644
--- a/src/ui/euph/room.rs
+++ b/src/ui/euph/room.rs
@@ -331,15 +331,6 @@ impl EuphRoom {
crossterm_lock: &Arc<FairMutex<()>>,
event: &InputEvent,
) -> bool {
- if let key!('I') = event {
- if let Some(id) = self.chat.cursor().await {
- if let Some(msg) = self.vault.msg(&id).await {
- self.state = State::Links(LinksState::new(&msg.content));
- }
- }
- return true;
- }
-
if let Some(room) = &self.room {
let status = room.status().await;
let can_compose = matches!(status, Ok(Some(Status::Joined(_))));
@@ -362,6 +353,15 @@ impl EuphRoom {
}
}
+ if let key!('I') = event {
+ if let Some(id) = self.chat.cursor().await {
+ if let Some(msg) = self.vault.msg(&id).await {
+ self.state = State::Links(LinksState::new(&msg.content));
+ }
+ }
+ return true;
+ }
+
match status.ok().flatten() {
Some(Status::Joining(Joining {
bounce: Some(_), ..
@@ -389,10 +389,25 @@ impl EuphRoom {
_ => false,
}
} else {
- self.chat
+ if self
+ .chat
.handle_input_event(terminal, crossterm_lock, event, false)
.await
.handled()
+ {
+ return true;
+ }
+
+ if let key!('I') = event {
+ if let Some(id) = self.chat.cursor().await {
+ if let Some(msg) = self.vault.msg(&id).await {
+ self.state = State::Links(LinksState::new(&msg.content));
+ }
+ }
+ return true;
+ }
+
+ false
}
}