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

selection is really hard to use for the non input caller #59

Open
pm100 opened this issue Feb 12, 2024 · 1 comment
Open

selection is really hard to use for the non input caller #59

pm100 opened this issue Feb 12, 2024 · 1 comment

Comments

@pm100
Copy link
Contributor

pm100 commented Feb 12, 2024

I have finally got the go ahead to put tui-textarea into gitui. I see that tta is now up to v0.4 and that now includes the keyboard based selection. I now see how you modified my original code.

The problem is that its very hard to use in the case where I am not using the keyboard dispatched via input. The new code there uses move_cursor_with_shift, this what I would have done except that it would have changed the existing API which I wanted to avoid. Which is why I came up with other stuff. Having a shift aware API makes it really easy (as your code shows), but that function is private.

Instead the non input using caller as to use start_selection and stop_selection. This means that I now have to reimplement the logic I already had in my original version that turns the selection on and off as the shift key is toggled, thats really tricky , even trickier outside TTA not having access to its insides (like is a selection already in progress?)

A simple solution would be to make the move_cursor_with_shift public, which would in fact make start_selection redundant (I think)

I think I can do the tricky thing for now but its not at all obvious what a caller needs to do (in the doc) and no samples show it either.

@pm100
Copy link
Contributor Author

pm100 commented Feb 18, 2024

@rhysd - good news, you have a new customer. tui-textarea finally merged into gitui, replacing their homegrown text input box. extrawurst/gitui#2051

ty for you help over the last 6 months

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant