Skip to content
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

bug: selection disappears when scrolled to index -1 or n #13

Closed
aidanaden opened this issue Jun 20, 2024 · 8 comments · Fixed by #14 or #20
Closed

bug: selection disappears when scrolled to index -1 or n #13

aidanaden opened this issue Jun 20, 2024 · 8 comments · Fixed by #14 or #20
Assignees
Labels
bug Something isn't working

Comments

@aidanaden
Copy link
Contributor

No description provided.

@aidanaden aidanaden added the bug Something isn't working label Jun 20, 2024
@aidanaden aidanaden self-assigned this Jun 20, 2024
@micielski
Copy link
Contributor

uhh i wasn't thinking about this as a bug, rather a feature - when scrolling down you can't see whether the current selection is the last one, so the disappearance of a selection is the only one currently indicator of this.
the best way to resolve this i think would be if ratatui implemented scroll_padding for Table as for List

@aidanaden
Copy link
Contributor Author

uhh i wasn't thinking about this as a bug, rather a feature - when scrolling down you can't see whether the current selection is the last one, so the disappearance of a selection is the only one currently indicator of this. the best way to resolve this i think would be if ratatui implemented scroll_padding for Table as for List

wouldn't restarting from the other end of the list indicate to the user that the end/start was reached? this happens after the selection disappears anyway .. i just felt confused when the selection disappeared LOL

@micielski
Copy link
Contributor

wouldn't restarting from the other end of the list indicate to the user that the end/start was reached? this happens after the selection disappears anyway .. i just felt confused when the selection disappeared LOL

yeah it may not be the most intuitive thing, but let keep this issue opened till ratatui doesn't implement padding for Table

@aidanaden
Copy link
Contributor Author

we could instead have a counter indicator that displays to the user the current position of the selected item in the list e.g. 12/200 which increments/decrements as the user moves up and down the list

we could place this indicator at the right-hand side of the table header OR at the bottom to the left of the disk size indicator

@micielski
Copy link
Contributor

we could instead have a counter indicator that displays to the user the current position of the selected item in the list e.g. 12/200 which increments/decrements as the user moves up and down the list

we could place this indicator at the right-hand side of the table header OR at the bottom to the left of the disk size indicator

i like the bottom better, seems like a place for it

@joshka
Copy link

joshka commented Jun 27, 2024

The next version of ratatui has first, last, next, previous methods on table state and caps the state to 0, items.len() when rendering the table - this might make it possible to remove a bunch of your code. Might be good to throw some feedback about missing things you've had to implement manually in the table if you have time.

@micielski
Copy link
Contributor

Might be good to throw some feedback about missing things you've had to implement manually in the table if you have time.

We've implemented:

  • scroll_down_by(amount: usize)
  • scroll_up_by(amount: usize)

which could've been just one method, but just with a signed integer. We use them to implement scrolling with PageDown and PageUp.

@joshka
Copy link

joshka commented Jun 27, 2024

Makes sense. Added ratatui/ratatui#1207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants