On Wed, 14 Aug 2024 18:33:30 GMT, Andy Goryachev <[email protected]> wrote:
>> tests/manual/RichTextAreaDemo/src/com/oracle/demo/richtext/codearea/DemoSyntaxDecorator.java
>> line 54:
>>
>>> 52:
>>> 53: @Override
>>> 54: public RichParagraph createRichParagraph(CodeTextModel model, int
>>> index) {
>>
>> When implementing "real" syntax highlighting, the style of a paragraph will
>> depend on the style of it's predecessors (e.g. multiline strings or
>> multiline comments)...
>
> Correct, this is just a demo.
>
> The information passed to the **SyntaxDecorator** interface should be
> sufficient to support any "real" syntax, at least I hope it is. We are
> passing the model to each method, so it can re/construct the syntax or cache
> it as needed.
Consider this situation: When a user types some text into paragraph 2, it may
change the styling in paragraph 2, 3, 4, ...
Will the createRichParagraph - method be called for each paragraph after each
typed character? That would probably be inefficient; On the other hand, if it
is only called for the paragraph the user typed in, that may not be enough.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1524#discussion_r1721217128