From 20c416a0cb63ad5d2e3f14eae42d2d7b2f13e946 Mon Sep 17 00:00:00 2001 From: Kevin Lamonte Date: Tue, 5 Nov 2019 20:21:10 -0600 Subject: [PATCH] fix mouse selection --- src/jexer/TEditorWidget.java | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) 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. * -- 2.27.0