Skip to content
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

Added line highlighter enhancement #845

Merged
merged 1 commit into from
Aug 22, 2019
Merged

Added line highlighter enhancement #845

merged 1 commit into from
Aug 22, 2019

Conversation

Jugen
Copy link
Collaborator

@Jugen Jugen commented Aug 22, 2019

This PR is for RFE #841 adding the following API to GenericStyledArea:

setLineHighlighterFill( Paint highlight )
setLineHighlighterOn( boolean show )
isLineHighlighterOn()

The highlighter can be styled via CSS using selectors from Path, Shape, and Node. For example:

.styled-text-area .line-highlighter { -fx-fill: lime; }
/* or */
.line-highlighter { -fx-highlight-fill: lime; }

Any added custom Selections can now also be styled via CSS using the selection's name.

@Jugen Jugen merged commit 3f8f305 into FXMisc:master Aug 22, 2019
@Jugen Jugen deleted the line_highlighter branch August 22, 2019 09:34
@garybentley
Copy link

This works great, thanks for adding it. There is just one issue though, if the line is empty, if the paragraph has zero length, then the highlight isn't shown.

@garybentley
Copy link

Just one other thing, if the line highlight paint is set it is overriding the default text selection paint.

In my stylesheet I have:

.selection
{
    -fx-fill: blue;
}

And am setting the line highlight paint via code, thus:

area.setLineHighlighterFill(Color.red);

Any selected text on that line has a red background rather than blue thus masking what text is selected.

@Jugen Jugen restored the line_highlighter branch August 25, 2019 18:15
@Jugen Jugen deleted the line_highlighter branch August 26, 2019 12:47
@Jugen
Copy link
Collaborator Author

Jugen commented Aug 28, 2019

Ok, I've made some changes that hopefully resolve the issues you reported.
Can you please test and let me know, thanks.

@garybentley
Copy link

Yes that fixed both issues. Thanks.

@garybentley
Copy link

Found another issue with this I'm afraid. The highlight can sometimes be "half" applied.

In the screenshot below you can see that the line highlight is only partially rendered. This is on a wrapping line and occurs after I resize (by a splitpane dragger) the left hand component to be larger. The text area contracts but the highlight will often not be fully rendered. Moving the caret to another line renders the highlight properly.

line-highlight-half

@garybentley
Copy link

There is another issue with this. I've added it here to keep things in the same place, hope you don't mind. I don't want to spam up the issues list.

If you have the line highlighter enabled and type at the start of the line then the highlight isn't drawn on the newly added text.

See below.

line-highlight-start

@Jugen
Copy link
Collaborator Author

Jugen commented Nov 11, 2019

Thanks, I've fixed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants