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

Tree.select_node doesn't select the node, it highlights it #4660

Closed
darrenburns opened this issue Jun 17, 2024 · 5 comments · Fixed by #4753
Closed

Tree.select_node doesn't select the node, it highlights it #4660

darrenburns opened this issue Jun 17, 2024 · 5 comments · Fixed by #4753
Labels
bug Something isn't working

Comments

@darrenburns
Copy link
Member

darrenburns commented Jun 17, 2024

The Tree message names make a distinction between highlighting a node and selecting a node.

This method name strongly suggests it'll select a node, but in reality it only highlights it (moves the cursor to a node).

I'd suggest renaming to something like move_cursor(node).

@darrenburns darrenburns added the bug Something isn't working label Jun 17, 2024
@TomJGooding
Copy link
Contributor

TomJGooding commented Jun 30, 2024

The docs do say that this will only "move the cursor to the given node", but the method name is perhaps a bit confusing.

@darrenburns
Copy link
Member Author

True - I think the problem is we're confusing the naming since we have a message called NodeSelected which does not get posted here.

I think renaming this to something like move_cursor(node) would be clearer.

@merriam
Copy link
Contributor

merriam commented Jul 9, 2024

FYI, DataTable carefully delineates hovering, moving, and selecting. It sounds like it would be good to make the breaking change to rename the message or change its meaning.

@darrenburns
Copy link
Member Author

Opened a PR for this in #4753.

  • Tree.move_cursor added - which just moves the cursor without selecting.
  • Tree.select_node updated to move the cursor to a node and then select it.

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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
Development

Successfully merging a pull request may close this issue.

3 participants