Skip to content

Commit 60b169f

Browse files
committed
Merge branch 'ctrlDeleteBehavior' of https://github.com/avargas-nearsoft/Arduino
2 parents aa68acd + a70bab3 commit 60b169f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

app/src/processing/app/syntax/SketchTextArea.java

+11
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030

3131
package processing.app.syntax;
3232

33+
import java.awt.event.InputEvent;
34+
import java.awt.event.KeyEvent;
35+
import javax.swing.KeyStroke;
3336
import org.apache.commons.compress.utils.IOUtils;
3437
import org.fife.ui.rsyntaxtextarea.*;
3538
import org.fife.ui.rsyntaxtextarea.Token;
@@ -56,6 +59,7 @@
5659
import java.net.URL;
5760
import java.util.Map;
5861
import java.util.logging.Logger;
62+
import processing.app.helpers.OSUtils;
5963

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

7782
public void setKeywords(PdeKeywords keywords) {
@@ -389,4 +394,10 @@ private void stopScanningForLinks() {
389394
protected RTextAreaUI createRTextAreaUI() {
390395
return new SketchTextAreaUI(this);
391396
}
397+
398+
private void fixCtrlDeleteBehavior() {
399+
int modifier = OSUtils.isMacOS()? InputEvent.ALT_MASK : InputEvent.CTRL_MASK;
400+
KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, modifier);
401+
getInputMap().put(keyStroke, SketchTextAreaEditorKit.rtaDeleteNextWordAction);
402+
}
392403
}

build/shared/revisions.txt

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ARDUINO 1.6.9
1414
* Make http://librarymanager and http://boardmanager links clickable from the editor window
1515
* Cut/Copy actions are disable when there is no text selected. Thanks @avargas-nearsoft
1616
* Added more OSX native (emacs-like) keybindings. Thanks @nopdotcom
17+
* Fixed Ctrl+Del: now deletes the word behind the cursor instead of the entire line. Thanks @avargas-nearsoft
1718

1819
[core]
1920
* sam: Allow 3rd party boards that depend on SAM core to use their own

0 commit comments

Comments
 (0)