-
Notifications
You must be signed in to change notification settings - Fork 236
Added setVisibleOnlyStyler method #1277
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
base: master
Are you sure you want to change the base?
Conversation
and use in JavaKeywordsDemo
This reverts commit 083b4b9.
@@ -1548,6 +1548,20 @@ public final PS getParagraphStyleForInsertionAt(int pos) { | |||
} | |||
} | |||
|
|||
private UnaryOperator<Paragraph<PS, SEG, S>> visibleOnlyStyler; | |||
/** | |||
* This styler will only be applied to Paragraphs, just before being displayed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cosmetic: I think the world "visible" is missing: "This style will only be applied to visible Paragraphs"
@@ -1548,6 +1548,20 @@ public final PS getParagraphStyleForInsertionAt(int pos) { | |||
} | |||
} | |||
|
|||
private UnaryOperator<Paragraph<PS, SEG, S>> visibleOnlyStyler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I do have an issue with this one. For some cases that might be good enough (those where the style fully depend only on the content of the line).
In my scenario, I have a group comment, meaning that the style of a line depends on its position.
Would it be possible to provide the paragraph and its position?
Addresses #1273 where styles are not always being applied.
To apply styling to particular portion of text we need to have a position of where that text is. The trouble is that the changes/modifications supplied by getVisibleParagraph don't provide a document paragraph index so it has to be queried with firstVisibleParToAllParIndex which at that point in time returns stale values as the scene graph hasn't been updated yet.
Here I've added a new method
setVisibleOnlyStyler
to GenericStyledArea that can be used to style paragraphs just before being displayed.