Question: Post append Stylespans
See original GitHub issueHey there, i have another question. But first: RichTextFX is a awesome Library and its amazing what you can do with it!
Im my Program, i am doing highlighting the same way as the JavaKeyWord Demo: https://github.com/FXMisc/RichTextFX/blob/master/richtextfx-demos/src/main/java/org/fxmisc/richtext/demo/JavaKeywords.java
Now my question, i want afterwards to add a background color to a line. And i only have the line Number.
I tried to get the spans with GenericStyleArea#getStyleSpans(int paragraph)
and then append it with the StyleSpans#append
method, sadly this did not work at all, after i saw that the append
method is returning the spans, i tried to re set these spans to the paragraph in the area, sadly also didnt work(infact there was a case where i ran into a stackoverflow Exception).
So my question: What is the proper way to add style to a specific line with style spans. (If i missed the point in the Documentation which explains that, i would be very happy if you could provide me with a link to it).
Regards Liz3
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:17 (10 by maintainers)
Top GitHub Comments
I’m having some difficulty in understanding what you’re trying to do.
It sounds like, somewhere in the method where you compute the
StyleSpans
for highlighting, that you would like to overlay another style on top of a section in theStyleSpans
object. Is that correct? In other words, you’re not trying to append a style to the end of theStyleSpans
object, so that it now is longer than before. You’re trying to do something like the following, which would implyoverlay
, correct?Which subclass of
GenericStyledArea
are you using?Hmm… I started to update the demo to use that and now I’m getting a recursive update like what you described. I’d guess that #695 has potentially introduced a regression.