-
Notifications
You must be signed in to change notification settings - Fork 236
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
Method to get style range at the current position. #26
Comments
Hi Maher, I could add such a method, I'm just not quite convinced about its general usefulness. The use-case you mention can get more tricky. Imagine, for example, that you have the word |
Hi Tomas, sorry writing late. This is a use case that would benefit from such a method. I managed to make a sketchy method that does the detection. Use case description: Steps: |
You should now be able to use IndexRange range = area.getStyleRangeAtPosition(area.getCaretPosition());
area.setStyle(range.getStart(), range.getEnd(), newStyle); |
Thanks :) On Mon, Apr 14, 2014 at 2:49 PM, TomasMikula notifications@github.comwrote:
|
Hi Tomas,
I came across this use case. I can make a method for it, but I thought of letting you know in case you think it is worth integrating as a general purpose method.
The method would the range(start and end) of the style at a current position.
steps would something like this:
get the style at the caret position
get the boundaries of the style from the caret position: start range of style (left of caret) and end range of the style (right of caret).
Once I get that range, I can then apply additional styling. not only for that location, but for the whole range of characters to its left and right of it.
The text was updated successfully, but these errors were encountered: