jcs
/wallops
/amendments
/74
chatter: Only autoscroll when the scrollbar is at the bottom
If the user has scrolled up, they probably want to keep reading until
they scroll back down.
jcs made amendment 74 2 months ago
--- chatter.c Mon Sep 9 16:18:36 2024
+++ chatter.c Mon Sep 9 16:49:01 2024
@@ -904,7 +904,7 @@ chatter_resize(struct focusable *focusable, EventRecor
TEUpdate(&(*(ttab->messages_te))->viewRect, ttab->messages_te);
HUnlock(ttab->messages_te);
TEPinScroll(0, INT_MAX, ttab->messages_te);
- /* this will scroll back down */
+ TEPinScroll(0, -INT_MAX, ttab->messages_te);
chatter_autoscroll(chatter, ttab->messages_te,
ttab->messages_scroller);
}
@@ -916,6 +916,7 @@ chatter_resize(struct focusable *focusable, EventRecor
chatter->current_tab->messages_te);
HUnlock(chatter->current_tab->messages_te);
TEPinScroll(0, INT_MAX, chatter->current_tab->messages_te);
+ TEPinScroll(0, -INT_MAX, chatter->current_tab->messages_te);
chatter_autoscroll(chatter, chatter->current_tab->messages_te,
chatter->current_tab->messages_scroller);
@@ -1231,8 +1232,12 @@ void
chatter_autoscroll(struct chatter *chatter, TEHandle te,
ControlHandle scroller)
{
- TEPinScroll(0, -INT_MAX, te);
- SetCtlValue(scroller, GetCtlMax(scroller));
+ /* only scroll down if we're already at the last line */
+ if (GetCtlValue(scroller) == GetCtlMax(scroller)) {
+ TEPinScroll(0, -INT_MAX, te);
+ SetCtlValue(scroller, GetCtlMax(scroller));
+ }
+
UpdateScrollbarForTE(chatter->win, scroller, te, false);
}