Skip to content

Commit

Permalink
linehighlighter off on selection (#1085)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jugen committed Feb 9, 2022
1 parent 23e43d9 commit ab086e3
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -1354,13 +1354,21 @@ public void setLineHighlighterOn( boolean show )
Consumer<Bounds> caretListener = b ->
{
if ( lineHighlighter != null && (b.getMinY() != caretPrevY || getCaretColumn() == 1) ) {
lineHighlighter.selectCurrentLine();
if ( getSelection().getLength() != 0 ) lineHighlighter.deselect();
else lineHighlighter.selectCurrentLine();
caretPrevY = b.getMinY();
}
};

caretBoundsProperty().addListener( (ob,ov,nv) -> nv.ifPresent( caretListener ) );
getCaretBounds().ifPresent( caretListener );
selectionProperty().addListener( (ob,ov,nv) ->
{
if ( lineHighlighter != null ) {
if ( nv.getLength() == 0 ) lineHighlighter.selectCurrentLine();
else if ( ov.getLength() == 0 ) lineHighlighter.deselect();
}
});
selectionSet.add( lineHighlighter );
}
else if ( lineHighlighter != null ) {
Expand Down

0 comments on commit ab086e3

Please sign in to comment.