You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/24 18:06:24 UTC
(maka) 11/17: fix(desktop): keep an open live thought scrolled to its newest text
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a commit to branch feat/desktop-gpui-spike
in repository https://gitbox.apache.org/repos/asf/maka.git
commit ed2706103aa7f898798785aec629fc4c88bf78db
Author: AstroHan <le...@outlook.com>
AuthorDate: Fri Sep 25 01:55:17 2026 +0800
fix(desktop): keep an open live thought scrolled to its newest text
The expanded detail of a streaming thought is capped at 400 px and did
not follow new text, so once thinking passed that height the peek froze
on its oldest lines. Each thought's detail now keeps a scroll handle and
follows the end while it streams, until the reader scrolls up.
Generated-by: Claude Code
---
crates/desktop/src/chat/mod.rs | 10 +++++++++-
crates/desktop/src/chat/view.rs | 34 ++++++++++++++++++++++++----------
2 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/crates/desktop/src/chat/mod.rs b/crates/desktop/src/chat/mod.rs
index 031b773a48..39a2e13c84 100644
--- a/crates/desktop/src/chat/mod.rs
+++ b/crates/desktop/src/chat/mod.rs
@@ -31,7 +31,7 @@ use crate::{
use gpui_kit::base::input::{InputEvent, TextareaState};
use gpui_kit::{
AnyWindowHandle, AppContext, Context, Entity, FocusHandle, FollowMode, ListAlignment,
- ListOffset, ListState, Pixels, SharedString, Subscription, Task, Window, px,
+ ListOffset, ListState, Pixels, ScrollHandle, SharedString, Subscription, Task, Window, px,
};
use maka_client::{
Client, RequestFailure,
@@ -99,6 +99,9 @@ pub struct Chat {
fold: Vec<Row>,
keys: Vec<String>,
bodies: HashMap<String, Body>,
+ /// Scroll of each thought's expanded detail, which follows new text
+ /// while the reader stays at its end.
+ peeks: HashMap<String, ScrollHandle>,
list: ListState,
scrollbar: Scrollbar,
selection: Selection,
@@ -192,6 +195,7 @@ impl Chat {
fold: Vec::new(),
keys: Vec::new(),
bodies: HashMap::new(),
+ peeks: HashMap::new(),
list,
scrollbar: Scrollbar::default(),
selection: Selection::default(),
@@ -528,9 +532,13 @@ impl Chat {
self.bodies.insert(key.clone(), Body::new(text, streaming));
}
}
+ if matches!(entry, Entry::Thought { .. }) {
+ self.peeks.entry(key.clone()).or_default();
+ }
seen.insert(key);
}
self.bodies.retain(|key, _| seen.contains(key));
+ self.peeks.retain(|key, _| seen.contains(key));
if let Some(sent) = &self.sent {
let row = format!("prompt:{sent}");
diff --git a/crates/desktop/src/chat/view.rs b/crates/desktop/src/chat/view.rs
index b83a93e59e..ee2eeaaad6 100644
--- a/crates/desktop/src/chat/view.rs
+++ b/crates/desktop/src/chat/view.rs
@@ -379,16 +379,30 @@ impl Chat {
.gap(px(8.));
let row: SharedString = item_key.to_owned().into();
match entry {
- Entry::Thought { id, .. } => match self.bodies.get(&format!("thought:{id}")) {
- Some(markdown) => body
- .child(md::render(
- markdown,
- &self.scope(&row, md::COMPACT, theme.muted),
- cx,
- ))
- .into_any_element(),
- None => body.into_any_element(),
- },
+ Entry::Thought { id, streaming, .. } => {
+ let key = format!("thought:{id}");
+ let body = match self.peeks.get(&key) {
+ Some(peek) => {
+ let (offset, max) = (peek.offset().y, peek.max_offset().y);
+ // Follow new text until the reader scrolls up.
+ if *streaming && -offset >= max - px(2.) {
+ peek.scroll_to_bottom();
+ }
+ body.track_scroll(peek)
+ }
+ None => body,
+ };
+ match self.bodies.get(&key) {
+ Some(markdown) => body
+ .child(md::render(
+ markdown,
+ &self.scope(&row, md::COMPACT, theme.muted),
+ cx,
+ ))
+ .into_any_element(),
+ None => body.into_any_element(),
+ }
+ }
Entry::Tool { result, .. } => {
let mut sections = Vec::new();
if let Some(input) = tools::input(entry) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org