mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
Middle mouse button pastes text only on linux: on other OSs it does nothing. Fixes #3266
This commit is contained in:
parent
8cfaf3c184
commit
a859cfb9f9
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 javax.swing.*;
|
||||
import javax.swing.text.Caret;
|
||||
import javax.swing.text.EditorKit;
|
||||
import javax.swing.text.JTextComponent;
|
||||
|
||||
@ -18,4 +19,11 @@ public class SketchTextAreaUI extends RSyntaxTextAreaUI {
|
||||
public EditorKit getEditorKit(JTextComponent tc) {
|
||||
return defaultKit;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Caret createCaret() {
|
||||
Caret caret = new MyConfigurableCaret();
|
||||
caret.setBlinkRate(500);
|
||||
return caret;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user