File tree Expand file tree Collapse file tree
richtextfx/src/main/java/org/fxmisc/richtext Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1354,13 +1354,21 @@ public void setLineHighlighterOn( boolean show )
13541354 Consumer <Bounds > caretListener = b ->
13551355 {
13561356 if ( lineHighlighter != null && (b .getMinY () != caretPrevY || getCaretColumn () == 1 ) ) {
1357- lineHighlighter .selectCurrentLine ();
1357+ if ( getSelection ().getLength () != 0 ) lineHighlighter .deselect ();
1358+ else lineHighlighter .selectCurrentLine ();
13581359 caretPrevY = b .getMinY ();
13591360 }
13601361 };
13611362
13621363 caretBoundsProperty ().addListener ( (ob ,ov ,nv ) -> nv .ifPresent ( caretListener ) );
13631364 getCaretBounds ().ifPresent ( caretListener );
1365+ selectionProperty ().addListener ( (ob ,ov ,nv ) ->
1366+ {
1367+ if ( lineHighlighter != null ) {
1368+ if ( nv .getLength () == 0 ) lineHighlighter .selectCurrentLine ();
1369+ else if ( ov .getLength () == 0 ) lineHighlighter .deselect ();
1370+ }
1371+ });
13641372 selectionSet .add ( lineHighlighter );
13651373 }
13661374 else if ( lineHighlighter != null ) {
You can’t perform that action at this time.
0 commit comments