gtk-qq icon indicating copy to clipboard operation
gtk-qq copied to clipboard

Scroll down chatroom view aumatically when pushing new message.

Open lomirus opened this issue 2 years ago • 2 comments

Requirements Description

  • When the user sends or receives a message, and the chatroom is right at the bottom, the chatroom view should automatically scroll down the view to the bottom.
  • If chatroom is not right at the bottom, no scroll operation is needed.

My Attempt

let adjustment = view.vadjustment();
adjustment.connect_changed(|adjustment| {
    // Scroll down the view
    let view_height = adjustment.upper() - adjustment.page_size();
    adjustment.set_value(view_height);
});

That's what I wrote trying to implement this function. However, it has a weird behaviour:

https://user-images.githubusercontent.com/21173956/169246535-3ce22603-9ad6-4675-a57b-790deb28fc82.mp4

As the video shows: the scrollbar updates, while the view does not.

Hopefully this message does help to you if you want to contribute about it.

PR WELCOME

lomirus avatar May 19 '22 08:05 lomirus

我将那部分代码加入后测试的结果是: 会滚动,但是不会滚动到底,大概会距离滚动到底差一个对话框

Goodjooy avatar Jul 15 '22 14:07 Goodjooy

https://github.com/melix99/telegrand/issues/13

Sinofine avatar Jul 29 '22 11:07 Sinofine