Keep chat scrolling under user control
This commit is contained in:
@@ -175,6 +175,7 @@ impl App {
|
||||
self.remember_project(project_id);
|
||||
self.selected_session = None;
|
||||
self.conversation.clear();
|
||||
self.chat_follow_tail = true;
|
||||
self.context_notice = None;
|
||||
self.clear_a2ui();
|
||||
self.composer.clear();
|
||||
@@ -189,6 +190,7 @@ impl App {
|
||||
pub(super) fn discard_session(&mut self, project_id: i32) {
|
||||
if self.drafts.remove(&project_id).is_some() && self.draft_selected(project_id) {
|
||||
self.conversation.clear();
|
||||
self.chat_follow_tail = true;
|
||||
self.context_notice = None;
|
||||
self.clear_a2ui();
|
||||
self.composer.clear();
|
||||
|
||||
@@ -315,9 +315,14 @@ impl App {
|
||||
.style(preference_group_style),
|
||||
);
|
||||
}
|
||||
let transcript = scrollable(messages)
|
||||
.id(chat_scroll_id())
|
||||
.height(Length::Fill);
|
||||
let transcript = if self.chat_follow_tail {
|
||||
scrollable(messages).anchor_bottom()
|
||||
} else {
|
||||
scrollable(messages)
|
||||
}
|
||||
.id(chat_scroll_id())
|
||||
.on_scroll(Message::ChatScrolled)
|
||||
.height(Length::Fill);
|
||||
let conversation = column![
|
||||
transcript,
|
||||
container(composer_content,)
|
||||
|
||||
Reference in New Issue
Block a user