diff --git a/src/com/valkryst/VTerminal/component/TextArea.java b/src/com/valkryst/VTerminal/component/TextArea.java index f56ea5ddad..a66377b2be 100644 --- a/src/com/valkryst/VTerminal/component/TextArea.java +++ b/src/com/valkryst/VTerminal/component/TextArea.java @@ -145,7 +145,7 @@ public void createEventListeners(final @NonNull Screen parentScreen) { final MouseListener mouseListener = new MouseListener() { @Override public void mouseClicked(final MouseEvent e) { - if (editable == false || isFocused() == false) { + if (editable == false) { return; } @@ -153,6 +153,13 @@ public void mouseClicked(final MouseEvent e) { return; } + if (intersects(parentScreen.getMousePosition())) { + setFocused(true); + } else { + setFocused(false); + return; + } + final Font font = parentScreen.getImageCache().getFont(); final int columnIndexInArea = (e.getX() / font.getWidth()) - tiles.getXPosition(); final int rowIndexInArea = (e.getY() / font.getHeight()) - tiles.getYPosition();