BlueGit

ict rusty-teams

fix(channels): typing in a tall post's reply box no longer jumps to the post top

- reveal only the bottom of the post card while the reply box grows
- scroll_to_reveal_item reset a partly scrolled tall row to its top

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-05 · 3 weeks ago

Hash
323236fed27d6c529857f809f5f1ade8d6765e50
Parent
02ebd398
2 files changed +12 −4
crates/app/src/views/conversation/feed.rs +1 −1
@@ -123,7 +123,7 @@ impl ConversationView {
123 123 let index = this.rows.borrow().iter().position(|row| row.key() == root_id);
124 124 if let Some(index) = index {
125 125 this.scroller
126 .update(cx, |scroller, cx| scroller.reveal_item(index, cx));
126 .update(cx, |scroller, cx| scroller.reveal_item_bottom(index, cx));
127 127 }
128 128 })
129 129 .ok();
@@ -123,7 +123,7 @@ impl ConversationView {
123 let index = this.rows.borrow().iter().position(|row| row.key() == root_id);
123 let index = this.rows.borrow().iter().position(|row| row.key() == root_id);
124 if let Some(index) = index {
124 if let Some(index) = index {
125 this.scroller
125 this.scroller
126 .update(cx, |scroller, cx| scroller.reveal_item(index, cx));
126 .update(cx, |scroller, cx| scroller.reveal_item_bottom(index, cx));
127 }
127 }
128 })
128 })
129 .ok();
129 .ok();
vendor/gpui-component/src/message_scroller.rs +11 −3
@@ -167,12 +167,20 @@ impl MessageScrollerState {
167 167 true
168 168 }
169 169
170 /// Scroll as little as needed to show the row at `index` in full.
171 pub fn reveal_item(&mut self, index: usize, cx: &mut Context<Self>) -> bool {
170 /// Scroll as little as needed to show the bottom of the row at `index`; a row taller than the viewport keeps its top out of view.
171 pub fn reveal_item_bottom(&mut self, index: usize, cx: &mut Context<Self>) -> bool {
172 172 if index >= self.list_state.item_count() {
173 173 return false;
174 174 }
175 self.list_state.scroll_to_reveal_item(index);
175 match self.list_state.bounds_for_item(index) {
176 Some(item) => {
177 let overflow = item.bottom() - self.list_state.viewport_bounds().bottom();
178 if overflow > px(0.) {
179 self.list_state.scroll_by(overflow);
180 }
181 }
182 None => self.list_state.scroll_to_reveal_item(index),
183 }
176 184 cx.notify();
177 185 true
178 186 }
@@ -167,12 +167,20 @@ impl MessageScrollerState {
167 true
167 true
168 }
168 }
169
169
170 /// Scroll as little as needed to show the row at `index` in full.
170 /// Scroll as little as needed to show the bottom of the row at `index`; a row taller than the viewport keeps its top out of view.
171 pub fn reveal_item(&mut self, index: usize, cx: &mut Context<Self>) -> bool {
171 pub fn reveal_item_bottom(&mut self, index: usize, cx: &mut Context<Self>) -> bool {
172 if index >= self.list_state.item_count() {
172 if index >= self.list_state.item_count() {
173 return false;
173 return false;
174 }
174 }
175 self.list_state.scroll_to_reveal_item(index);
175 match self.list_state.bounds_for_item(index) {
176 Some(item) => {
177 let overflow = item.bottom() - self.list_state.viewport_bounds().bottom();
178 if overflow > px(0.) {
179 self.list_state.scroll_by(overflow);
180 }
181 }
182 None => self.list_state.scroll_to_reveal_item(index),
183 }
176 cx.notify();
184 cx.notify();
177 true
185 true
178 }
186 }