-
Notifications
You must be signed in to change notification settings - Fork 25
feat: Query if ScrollViewState is_at_bottom() #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Teufelchen1
wants to merge
5
commits into
ratatui:main
Choose a base branch
from
Teufelchen1:feat/is_at_bottom
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7b0e319
feat: Query if ScrollViewState is_at_bottom()
Teufelchen1 7a62a60
review: remove accidential added change to for loop
Teufelchen1 805d875
review: Enhance doc strings
Teufelchen1 cbfbe82
review: Remove precondition test from unit test
Teufelchen1 2fe46b9
review: Adjust line wrapping
Teufelchen1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this clone is needed here
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is actually reassuring to see that you also don't get it immediately (makes me feel less like an idiot). I was very confused when Rust hit me with this (when you omit that
clone()):error[E0382]: use of moved value: `scroll_view` --> tui-scrollview/src/scroll_view.rs:482:9 | 454 | fn move_to_bottom(scroll_view: ScrollView) { | ----------- move occurs because `scroll_view` has type `scroll_view::ScrollView`, which does not implement the `Copy` trait ... 461 | scroll_view.render(buf.area, &mut buf, &mut state); | -------------------------------------- `scroll_view` moved due to this method call ... 482 | scroll_view.render(buf.area, &mut buf, &mut state); | ^^^^^^^^^^^ value used here after move | note: `ratatui::prelude::StatefulWidget::render` takes ownership of the receiver `self`, which moves `scroll_view` --> /home/teufelchen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ratatui-0.29.0/src/widgets.rs:244:15 | 244 | fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State); | ^^^^ help: you can `clone` the value and consume it, but this might not be your desired behavior | 461 | scroll_view.clone().render(buf.area, &mut buf, &mut state); | ++++++++ For more information about this error, try `rustc --explain E0382`.I have to admit I am unable to explain it really. I figured it has something to do with
#[fixture]or#[rstest]which I don't know about. Hence I just went with the compiler hint / the clone.