From 2dfdbbb4d2dfff7694901b706edfd98cc59566d2 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 3 Aug 2022 03:06:04 +0200 Subject: [PATCH] Fix scrolling when composing a new thread When composing a new thread and writing more than one line, the chat wouldn't scroll to make the editor cursor visible again. My original guess for when the scrolling code should run was a bit too restrictive. --- src/ui/chat/tree/layout.rs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/ui/chat/tree/layout.rs b/src/ui/chat/tree/layout.rs index eee5975..6866142 100644 --- a/src/ui/chat/tree/layout.rs +++ b/src/ui/chat/tree/layout.rs @@ -327,21 +327,8 @@ impl> InnerTreeViewState { } fn scroll_so_cursor_is_visible(&self, frame: &mut Frame, blocks: &mut TreeBlocks) { - if !matches!( - self.cursor, - Cursor::Msg(_) - | Cursor::Editor { - parent: Some(_), - .. - } - | Cursor::Pseudo { - parent: Some(_), - .. - } - ) { - // In all other cases, there is no need to make the cursor visible - // since scrolling behaves differently enough. - return; + if matches!(self.cursor, Cursor::Bottom) { + return; // Cursor is locked to bottom } let block = blocks