-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
UI - Input: Cursor should not shift text content #415
Comments
Thanks for the report & gif, @aweary! Confirmed on Windows - it seems like we're including the cursor in the text calculation (which is shifting the text). |
@bryphe I’m happy to work on this if you can give a few code pointers to get started with 🙂 |
Would be great to have some help with the input 😍, at the moment the cursor is in the flow which causes this issue. We began discussing some of the ongoing issues with the input in #203. Something we haven't done yet is expose a way of finding out where a character is in the text which would allow us able to position the cursor absolutely |
Definitely, would be awesome to have help @aweary ! 💯 Some ideas for starting out - this code here is important: revery/src/UI_Components/Input.re Line 240 in 41f97bd
(This is where we split the text and put a cursor in the middle). We actually have an API to measure text size here: Line 38 in 41f97bd
Instead of rendering the cursor 'in the flow' - we could measure the This will get a bit more complicated in the case of multi-line text, but I believe our inputs only handle the single-line case (something we'll have to think about as we extend them to support multi-line!). |
The issue seems to be that the cursor
View
is part of the normal content flow, so when it moves it also shifts the characters around. I checked oni2 and it doesn't have this problem since it uses absolute positioning for the cursor and manually calculates the offset. It seems like something similar should be done here for theInput
component.The text was updated successfully, but these errors were encountered: