Skip to content

Change the CTRL+DELETE behaviour to delete the next word #4815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/src/processing/app/syntax/SketchTextArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

package processing.app.syntax;

import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import javax.swing.KeyStroke;
import org.apache.commons.compress.utils.IOUtils;
import org.fife.ui.rsyntaxtextarea.*;
import org.fife.ui.rsyntaxtextarea.Token;
Expand All @@ -56,6 +59,7 @@
import java.net.URL;
import java.util.Map;
import java.util.logging.Logger;
import processing.app.helpers.OSUtils;

/**
* Arduino Sketch code editor based on RSyntaxTextArea (http://fifesoft.com/rsyntaxtextarea)
Expand All @@ -72,6 +76,7 @@ public class SketchTextArea extends RSyntaxTextArea {
public SketchTextArea(PdeKeywords pdeKeywords) throws IOException {
this.pdeKeywords = pdeKeywords;
installFeatures();
fixCtrlDeleteBehavior();
}

public void setKeywords(PdeKeywords keywords) {
Expand Down Expand Up @@ -389,4 +394,10 @@ private void stopScanningForLinks() {
protected RTextAreaUI createRTextAreaUI() {
return new SketchTextAreaUI(this);
}

private void fixCtrlDeleteBehavior() {
int modifier = OSUtils.isMacOS()? InputEvent.ALT_MASK : InputEvent.CTRL_MASK;
KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, modifier);
getInputMap().put(keyStroke, SketchTextAreaEditorKit.rtaDeleteNextWordAction);
}
}