From 1bf4035c575952cd733c20e608c41bd856017c6b Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 17:52:32 +0100 Subject: [PATCH] Remove message editor cursor when unfocused --- CHANGELOG.md | 1 + cove/src/ui/chat/tree/renderer.rs | 9 ++++++--- cove/src/ui/chat/tree/widgets.rs | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e2bb08..d0c101c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ Procedure when bumping the version number: - The config file format was changed to support multiple euph servers with different domains. Options previously located at `euph.rooms.*` should be reviewed and moved to `euph.servers."euphoria.leet.nu".rooms.*`. - Tweaked F1 popup +- Tweaked chat message editor when nick list is foused ### Fixed - Room deletion popup accepting any room name diff --git a/cove/src/ui/chat/tree/renderer.rs b/cove/src/ui/chat/tree/renderer.rs index e6753c7..945f77c 100644 --- a/cove/src/ui/chat/tree/renderer.rs +++ b/cove/src/ui/chat/tree/renderer.rs @@ -148,8 +148,12 @@ where None => TreeBlockId::Bottom, }; - // TODO Unhighlighted version when focusing on nick list - let widget = widgets::editor::(indent, &self.context.nick, self.editor); + let widget = widgets::editor::( + indent, + &self.context.nick, + self.context.focused, + self.editor, + ); let widget = Self::predraw(widget, self.context.size, self.widthdb); let mut block = Block::new(id, widget, false); @@ -167,7 +171,6 @@ where None => TreeBlockId::Bottom, }; - // TODO Unhighlighted version when focusing on nick list let widget = widgets::pseudo::(indent, &self.context.nick, self.editor); let widget = Self::predraw(widget, self.context.size, self.widthdb); Block::new(id, widget, false) diff --git a/cove/src/ui/chat/tree/widgets.rs b/cove/src/ui/chat/tree/widgets.rs index ecdb7f4..e52704e 100644 --- a/cove/src/ui/chat/tree/widgets.rs +++ b/cove/src/ui/chat/tree/widgets.rs @@ -116,10 +116,14 @@ pub fn msg_placeholder( pub fn editor<'a, M: ChatMsg>( indent: usize, nick: &str, + focus: bool, editor: &'a mut EditorState, ) -> Boxed<'a, Infallible> { let (nick, content) = M::edit(nick, editor.text()); - let editor = editor.widget().with_highlight(|_| content); + let editor = editor + .widget() + .with_highlight(|_| content) + .with_focus(focus); Join5::horizontal( Seen::new(true).segment().with_fixed(true),