Closed PavelTurk closed 4 months ago
I was thinking about the following solution:
codeArea.setStyleClass(from, to, "highlighted");
textProperty
. Using old value, new value and caret position I get information about text change.var styles = stycodeArea.getStyleAtPosition(position);
if styles contains my "highlighted" style class then
var range = codeArea.getStyleRangeAtPosition(position)
update styles in this range ???
Is this a correct way?
Yes that sounds about right .....
@Jugen Thank you very much for your answer. Do I understand it correctly that there is no low level API for getting text changes in RichTextFX? For example, I would like to get events - text added/removed/replaced with text and positions.
You can use either plainTextChanges
or richChanges
which includes style changes.
@Jugen Yes, this is what I was looking for. Thank you very much for your help.
I have a
CodeArea
with text that can be modified by user. Now, I want to implementHighlight All
for all found matches (for search).As I understand for all found matches I do
codeArea. setStyle(from, to, style)
. But, if the user updates some match so that it shouldn't be highlighted anymore then how should I control what text was modified to remove highlighting? What if user pastes some text inside found match or deletes large block of text? Could anyone say how such things are done with RichTextFX?