Skip to content

Commit

Permalink
InputMethodRequest getTextLocation fix (#1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jugen authored Jan 25, 2022
1 parent 6f8cec7 commit dd6aa7f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,10 @@ private void initInputMethodHandling()
setInputMethodRequests( new InputMethodRequests()
{
@Override public Point2D getTextLocation( int offset ) {
Bounds charBounds = getCaretBounds().get();
return new Point2D( charBounds.getMaxX() - 5, charBounds.getMaxY() );
return getCaretBounds()
.or( () -> getCharacterBoundsOnScreen( offset, offset ) )
.map( cb -> new Point2D( cb.getMaxX() - 5, cb.getMaxY() ) )
.orElseGet( () -> new Point2D( 10,10 ) );
}

@Override public int getLocationOffset( int x, int y ) {
Expand Down

0 comments on commit dd6aa7f

Please sign in to comment.