-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
No way to set cursor position specified in characters #378
Comments
Unlike textarea which is character based, Ace is completely line based. This makes indexing by character a rather expensive operation. At this point I have no intention to add something like a moveCursorToIndex or convertIndexToPosition method. It should be easy to be implemented by the user, which also make him aware of the computational costs involved. |
Thanks for the answer |
Fwiw, I'm banging my head against the wall right now because these api's are missing. It might make sense to not expose them from the editor pov, but certain operations really do work with the text in a serial way. Maybe it's a good idea to expose these methods in a plugin? Gives you an extra chance to warn that the computation is pretty expensive, but that if you still want it, the plugin can do it for you. We've managed to get to it now, but with the arcane way we went about it, I'm still unsure whether it's "the right way" (tm). |
The problem is that there is no |
If nothing else, then yeah. I'm sure somebody will be happy to find examples on how to translate index2pos and pos2index. |
There doesn't appear to be any way of setting the cursor position from the start of the text being edited. This is possible with a plain textarea but is only possible by calculating the row and column and using moveCursorTo in Ace.
Example: say I have a 100 char long string scattered with newlines and want to move to the 50th char, this can't be done easily with the current implementation. Maybe a moveCursorToIndex method? ...am I missing something obvious?
The text was updated successfully, but these errors were encountered: