Index: org/gjt/sp/jedit/textarea/MouseHandler.java
===================================================================
--- org/gjt/sp/jedit/textarea/MouseHandler.java	(revision 24028)
+++ org/gjt/sp/jedit/textarea/MouseHandler.java	(working copy)
@@ -27,9 +27,9 @@
 import java.awt.event.*;
 
 import org.gjt.sp.jedit.EditBus;
-import org.gjt.sp.jedit.Registers;
 import org.gjt.sp.jedit.OperatingSystem;
 import org.gjt.sp.jedit.msg.PositionChanging;
+
 //}}}
 
 /** The mouseHandler used for jEdit.
@@ -48,149 +48,10 @@
 	@Override
 	public void mousePressed(MouseEvent evt)
 	{
-		showCursor();
-
-		int btn = evt.getButton();
-		if (btn != MouseEvent.BUTTON1 && btn != MouseEvent.BUTTON2 && btn != MouseEvent.BUTTON3)
-		{
-			// Suppress presses with unknown button, to avoid
-			// problems due to horizontal scrolling.
-			return;
-		}
-
-		control = (OperatingSystem.isMacOS() && evt.isMetaDown())
-			|| (!OperatingSystem.isMacOS() && evt.isControlDown());
-
-		ctrlForRectangularSelection = textArea.isCtrlForRectangularSelection();
-
-		// so that Home <mouse click> Home is not the same
-		// as pressing Home twice in a row
-		textArea.getInputHandler().resetLastActionCount();
-
-		quickCopyDrag = (textArea.isQuickCopyEnabled() &&
-			isMiddleButton(evt.getModifiers()));
-
-		if(!quickCopyDrag)
-		{
-			textArea.requestFocus();
-			TextArea.focusedComponent = textArea;
-		}
-
-		if(textArea.getBuffer().isLoading())
-			return;
+		super.mousePressed(evt);
 		EditBus.send(new PositionChanging(textArea));
-		int x = evt.getX();
-		int y = evt.getY();
-
-		dragStart = textArea.xyToOffset(x,y,
-			!(textArea.getPainter().isBlockCaretEnabled()
-			|| textArea.isOverwriteEnabled()));
-		dragStartLine = textArea.getLineOfOffset(dragStart);
-		dragStartOffset = dragStart - textArea.getLineStartOffset(
-			dragStartLine);
-
-		if(isPopupTrigger(evt)
-			&& textArea.getRightClickPopup() != null)
-		{
-			if(textArea.isRightClickPopupEnabled())
-				textArea.handlePopupTrigger(evt);
-			return;
-		}
-
-		dragged = false;
-
-		textArea.blink = true;
-		textArea.invalidateLine(textArea.getCaretLine());
-
-		clickCount = evt.getClickCount();
-
-		if(textArea.isDragEnabled()
-			&& textArea.selectionManager.insideSelection(x,y)
-			&& clickCount == 1 && !evt.isShiftDown())
-		{
-			maybeDragAndDrop = true;
-
-			textArea.moveCaretPosition(dragStart,false);
-			return;
-		}
-
-		maybeDragAndDrop = false;
-
-		if(quickCopyDrag)
-		{
-			// ignore double clicks of middle button
-			doSingleClick(evt);
-		}
-		else
-		{
-			switch(clickCount)
-			{
-			case 1:
-				doSingleClick(evt);
-				break;
-			case 2:
-				doDoubleClick();
-				break;
-			default: //case 3:
-				doTripleClick();
-				break;
-			}
-		}
 	} //}}}
 
-	//{{{ mouseReleased() method
-	@Override
-	public void mouseReleased(MouseEvent evt)
-	{
-		int btn = evt.getButton();
-		if (btn != MouseEvent.BUTTON1 && btn != MouseEvent.BUTTON2 && btn != MouseEvent.BUTTON3)
-		{
-			// Suppress releases with unknown button, to avoid
-			// problems due to horizontal scrolling.
-			return;
-		}
-
-		// middle mouse button drag inserts selection
-		// at caret position
-		Selection sel = textArea.getSelectionAtOffset(dragStart);
-		if(dragged && sel != null)
-		{
-			Registers.setRegister('%',textArea.getSelectedText(sel));
-			if(quickCopyDrag)
-			{
-				textArea.removeFromSelection(sel);
-				Registers.paste(TextArea.focusedComponent,
-					'%',sel instanceof Selection.Rect);
-
-				TextArea.focusedComponent.requestFocus();
-			}
-		}
-		else if(!dragged && textArea.isQuickCopyEnabled() &&
-			isMiddleButton(evt.getModifiers()))
-		{
-			textArea.requestFocus();
-			TextArea.focusedComponent = textArea;
-
-			textArea.setCaretPosition(dragStart,false);
-			if(!textArea.isEditable())
-				textArea.getToolkit().beep();
-			else
-				Registers.paste(textArea,'%',control);
-		}
-		else if(maybeDragAndDrop
-			&& !textArea.isMultipleSelectionEnabled())
-		{
-			textArea.selectNone();
-		}
-
-		maybeDragAndDrop = false;
-		dragged = false;
-		if(!(textArea.isRectangularSelectionEnabled()
-			|| (control && ctrlForRectangularSelection)))
-			// avoid scrolling away from rectangular selection
-			textArea.scrollToCaret(false);
-	} //}}}
-
 	//{{{ Private members
 	private JEditTextArea textArea;
 	//}}}
Index: org/gjt/sp/jedit/textarea/TextAreaMouseHandler.java
===================================================================
--- org/gjt/sp/jedit/textarea/TextAreaMouseHandler.java	(revision 24028)
+++ org/gjt/sp/jedit/textarea/TextAreaMouseHandler.java	(working copy)
@@ -24,6 +24,7 @@
 import org.gjt.sp.jedit.OperatingSystem;
 import org.gjt.sp.jedit.TextUtilities;
 import org.gjt.sp.util.StandardUtilities;
+import org.gjt.sp.jedit.Registers;
 
 import javax.swing.event.MouseInputAdapter;
 import java.awt.event.MouseEvent;
@@ -49,10 +50,18 @@
 	{
 		showCursor();
 
+		int btn = evt.getButton();
+		if (btn != MouseEvent.BUTTON1 && btn != MouseEvent.BUTTON2 && btn != MouseEvent.BUTTON3)
+		{
+			// Suppress presses with unknown button, to avoid
+			// problems due to horizontal scrolling.
+			return;
+		}
+
 		control = (OperatingSystem.isMacOS() && evt.isMetaDown())
 			|| (!OperatingSystem.isMacOS() && evt.isControlDown());
 
-		ctrlForRectangularSelection = true;
+		ctrlForRectangularSelection = textArea.isCtrlForRectangularSelection();
 
 		// so that Home <mouse click> Home is not the same
 		// as pressing Home twice in a row
@@ -80,10 +89,12 @@
 		dragStartOffset = dragStart - textArea.getLineStartOffset(
 			dragStartLine);
 
-		if(isPopupTrigger(evt) && textArea.isRightClickPopupEnabled())
+		if(isPopupTrigger(evt)
+			&& textArea.getRightClickPopup() != null)
 		{
+			if(textArea.isRightClickPopupEnabled())
 				textArea.handlePopupTrigger(evt);
-				return;
+			return;
 		}
 
 		dragged = false;
@@ -512,7 +523,30 @@
 	@Override
 	public void mouseReleased(MouseEvent evt)
 	{
-		if(!dragged && textArea.isQuickCopyEnabled() &&
+		int btn = evt.getButton();
+		if (btn != MouseEvent.BUTTON1 && btn != MouseEvent.BUTTON2 && btn != MouseEvent.BUTTON3)
+		{
+			// Suppress releases with unknown button, to avoid
+			// problems due to horizontal scrolling.
+			return;
+		}
+
+		// middle mouse button drag inserts selection
+		// at caret position
+		Selection sel = textArea.getSelectionAtOffset(dragStart);
+		if(dragged && sel != null)
+		{
+			Registers.setRegister('%',textArea.getSelectedText(sel));
+			if(quickCopyDrag)
+			{
+				textArea.removeFromSelection(sel);
+				Registers.paste(TextArea.focusedComponent,
+					'%',sel instanceof Selection.Rect);
+
+				TextArea.focusedComponent.requestFocus();
+			}
+		}
+		else if(!dragged && textArea.isQuickCopyEnabled() &&
 			isMiddleButton(evt.getModifiers()))
 		{
 			textArea.requestFocus();
@@ -519,6 +553,10 @@
 			TextArea.focusedComponent = textArea;
 
 			textArea.setCaretPosition(dragStart,false);
+			if(!textArea.isEditable())
+				textArea.getToolkit().beep();
+			else
+				Registers.paste(textArea,'%',control);
 		}
 		else if(maybeDragAndDrop
 			&& !textArea.isMultipleSelectionEnabled())
@@ -526,7 +564,12 @@
 			textArea.selectNone();
 		}
 
+		maybeDragAndDrop = false;
 		dragged = false;
+		if(!(textArea.isRectangularSelectionEnabled()
+			|| (control && ctrlForRectangularSelection)))
+			// avoid scrolling away from rectangular selection
+			textArea.scrollToCaret(false);
 	} //}}}
 
 	//{{{ isPopupTrigger() method
