From: Kevin Lamonte Date: Wed, 6 Nov 2019 02:21:10 +0000 (-0600) Subject: fix mouse selection X-Git-Tag: fanfix-swing-0.0.1~12^2~13^2^2~26 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=20c416a0cb63ad5d2e3f14eae42d2d7b2f13e946;p=fanfix-swing.git fix mouse selection --- diff --git a/src/jexer/TEditorWidget.java b/src/jexer/TEditorWidget.java index 893145b8..a329dfa3 100644 --- a/src/jexer/TEditorWidget.java +++ b/src/jexer/TEditorWidget.java @@ -164,16 +164,11 @@ public class TEditorWidget extends TWidget implements EditMenuUser { if (mouse.isMouse1()) { // Selection. - if (inSelection) { - selectionColumn1 = leftColumn + mouse.getX(); - selectionLine1 = topLine + mouse.getY(); - } else if (mouse.isShift()) { - inSelection = true; - selectionColumn0 = leftColumn + mouse.getX(); - selectionLine0 = topLine + mouse.getY(); - selectionColumn1 = selectionColumn0; - selectionLine1 = selectionLine0; - } + inSelection = true; + selectionColumn0 = leftColumn + mouse.getX(); + selectionLine0 = topLine + mouse.getY(); + selectionColumn1 = selectionColumn0; + selectionLine1 = selectionLine0; // Set the row and column int newLine = topLine + mouse.getY(); @@ -230,7 +225,7 @@ public class TEditorWidget extends TWidget implements EditMenuUser { if (inSelection) { selectionColumn1 = leftColumn + mouse.getX(); selectionLine1 = topLine + mouse.getY(); - } else if (mouse.isShift()) { + } else { inSelection = true; selectionColumn0 = leftColumn + mouse.getX(); selectionLine0 = topLine + mouse.getY(); @@ -272,27 +267,12 @@ public class TEditorWidget extends TWidget implements EditMenuUser { selectionLine1 = document.getLineNumber(); } return; - } else { - inSelection = false; } // Pass to children super.onMouseDown(mouse); } - /** - * Handle mouse release events. - * - * @param mouse mouse button release event - */ - @Override - public void onMouseUp(final TMouseEvent mouse) { - inSelection = false; - - // Pass to children - super.onMouseDown(mouse); - } - /** * Handle keystrokes. *