You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, for my use case (home automation tui) I want to be able to select two or more items in the tree. I would like to have a difference between the current position in the tree and all the other selected items.
The current position is a highlighted item. By pressing or the highlighted item changes, its a sort of cursor. Using another key I can then select or unselect the currently highlighted item.
I can achieve this by rebuilding the try and styling/changing the text of different entries. That gets rather ugly as I then have to manually keep track of the selections.
I see two possible api's:
Add a highlight style/symbol to TreeState::select.
Introduce the concept of a cursor which is moved by TreeState::key_up/TreeState::key_down then add TreeState::select_current/TreeState::unselect_current to add/remove the item that is currently the cursor to the selected items.
The first API gives more freedom to users, it could be used to do other things have n-different selection's for example. This comes at the cost of requiring users to do the bookkeeping of which selected item is the cursor vs a 'normal' selected item. The second makes my usecase trivial to implement but its the only additional usecase supported.
The best, and most work, might be to implement both the concept of differently styled selected items and a cursor.
Let me know what you think.
The text was updated successfully, but these errors were encountered:
Oh I should add that since I need this in my (hobby) project I'll have to implement it anyway. So I could do the work if this request is accepted and we settle on an API.
Hi there, for my use case (home automation tui) I want to be able to select two or more items in the tree. I would like to have a difference between the current position in the tree and all the other selected items.
The current position is a highlighted item. By pressing or the highlighted item changes, its a sort of cursor. Using another key I can then select or unselect the currently highlighted item.
I can achieve this by rebuilding the try and styling/changing the text of different entries. That gets rather ugly as I then have to manually keep track of the selections.
I see two possible api's:
TreeState::select
.TreeState::key_up
/TreeState::key_down
then addTreeState::select_current
/TreeState::unselect_current
to add/remove the item that is currently the cursor to the selected items.The first API gives more freedom to users, it could be used to do other things have n-different selection's for example. This comes at the cost of requiring users to do the bookkeeping of which selected item is the cursor vs a 'normal' selected item. The second makes my usecase trivial to implement but its the only additional usecase supported.
The best, and most work, might be to implement both the concept of differently styled selected items and a cursor.
Let me know what you think.
The text was updated successfully, but these errors were encountered: