mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-20 21:01:25 +03:00
Middle mouse button pastes text only on linux: on other OSs it does nothing. Fixes #3266
This commit is contained in:
23
app/src/processing/app/syntax/MyConfigurableCaret.java
Normal file
23
app/src/processing/app/syntax/MyConfigurableCaret.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package processing.app.syntax;
|
||||||
|
|
||||||
|
import org.fife.ui.rtextarea.ConfigurableCaret;
|
||||||
|
import processing.app.helpers.OSUtils;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
|
public class MyConfigurableCaret extends ConfigurableCaret {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
if (e.isConsumed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!OSUtils.isLinux() && SwingUtilities.isMiddleMouseButton(e)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.mouseClicked(e);
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ package processing.app.syntax;
|
|||||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaUI;
|
import org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaUI;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.text.Caret;
|
||||||
import javax.swing.text.EditorKit;
|
import javax.swing.text.EditorKit;
|
||||||
import javax.swing.text.JTextComponent;
|
import javax.swing.text.JTextComponent;
|
||||||
|
|
||||||
@ -18,4 +19,11 @@ public class SketchTextAreaUI extends RSyntaxTextAreaUI {
|
|||||||
public EditorKit getEditorKit(JTextComponent tc) {
|
public EditorKit getEditorKit(JTextComponent tc) {
|
||||||
return defaultKit;
|
return defaultKit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Caret createCaret() {
|
||||||
|
Caret caret = new MyConfigurableCaret();
|
||||||
|
caret.setBlinkRate(500);
|
||||||
|
return caret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user