1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-19 08:52:15 +01:00

Add suport for OSX (ALT+DELETE)

This commit is contained in:
Arturo Vargas 2016-04-06 08:25:39 -07:00
parent 3efcc9ec48
commit a70bab3ea0

View File

@ -30,6 +30,7 @@
package processing.app.syntax; package processing.app.syntax;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import org.apache.commons.compress.utils.IOUtils; import org.apache.commons.compress.utils.IOUtils;
@ -58,6 +59,7 @@ import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import java.util.logging.Logger;
import processing.app.helpers.OSUtils;
/** /**
* Arduino Sketch code editor based on RSyntaxTextArea (http://fifesoft.com/rsyntaxtextarea) * Arduino Sketch code editor based on RSyntaxTextArea (http://fifesoft.com/rsyntaxtextarea)
@ -394,8 +396,8 @@ public class SketchTextArea extends RSyntaxTextArea {
} }
private void fixCtrlDeleteBehavior() { private void fixCtrlDeleteBehavior() {
KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, int modifier = OSUtils.isMacOS()? InputEvent.ALT_MASK : InputEvent.CTRL_MASK;
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()); KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, modifier);
getInputMap().put(keyStroke, SketchTextAreaEditorKit.rtaDeleteNextWordAction); getInputMap().put(keyStroke, SketchTextAreaEditorKit.rtaDeleteNextWordAction);
} }
} }