[BUG] `ScrollView::scroll_to_top` doesn't work with `ScrollStrategy::StickToBottom`
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 270
- Avg merge
- 5d 19h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
I tried using `scroll_to_top()` on a `ScrollView` which has `ScrollStrategy::StickToBottom` set, and nothing happened.
**To Reproduce**
```rust
// Attach this to a global keybinding
pub fn debug_dialog(cursive: &mut Cursive) {
let debug_view =
FlexiLoggerView::new()
.no_indent()
.scrollable()
.scroll_strategy(ScrollStrategy::StickToBottom)
.scroll_x(true)
.scroll_y(true)
.with_name("debug");
let dialog = Dialog::around(debug_view)
.button("Top", |c| {
c.call_on_name("debug", |view: &mut ScrollView| {
view.scroll_to_top();
});
})
.dismiss_button("Close")
.full_screen();
cursive.add_fullscreen_layer(dialog);
}
```
**Expected behavior**
Despite the set scroll strategy, I expected the `ScrollView` to scroll to the top, since nothing new was being added to make the view scroll back down agian.
**Screenshots**
N/A
**Environment**
* Operating system used: Linux
* Backend used: ncurses
* Current locale: en_US.UTF-8
* Cursive version: From crates.io, v0.17.0
**Additional context**
N/A
Contributor guide
Assessment
This issue has not been assessed yet.