Nicer support for scrolling a row/line/tree node to a specific line of screen space #5904
RedBeard0531
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This feels like it should be a common need, but I've had to do some rather hacky code (using APIs I'm not 100% sure were intended to be public) to do so for TextArea and Tree Nodes, and I've found it doesn't work all of the time anyway.
While the lower-level scroll X logical entity to row X of relative screen space seems like a nice primitive to expose, I actually think that the best option would be to offer some better defaults. For example, it would be nice if at least TextArea and Tree supported a
context_lines
option which ensured that the cursor/selected row had a certain amount of context above or below when moving it around. It could be either a reactive or a TCSS property, and ideally would support either a number of lines or a percentage relative to the visible size of the widget content. For prior art, see (n)vim's scrolloff and VSCode's editor.cursorSurroundingLines options. Also when expanding a tree node, if the children aren't all visible, it probably makes sense to scroll the view down (or up depending on your POV) so that either all children are visible, or the expanded node is the top line (ideally offset bycontext_lines
). Right now when you expand the bottom row you can't see any children which isn't a good UX. The only way to see that anything has happened is that the arrow on the left changes direction but that is very subtle.Beta Was this translation helpful? Give feedback.
All reactions