diff --git a/app/src/processing/app/syntax/PdeInputHandler.java b/app/src/processing/app/syntax/PdeInputHandler.java index be918de07..bf0a7cdf6 100755 --- a/app/src/processing/app/syntax/PdeInputHandler.java +++ b/app/src/processing/app/syntax/PdeInputHandler.java @@ -30,6 +30,7 @@ import java.awt.event.KeyEvent; import processing.app.Platform; import processing.app.Preferences; +import processing.app.ui.Editor; /** @@ -39,7 +40,17 @@ import processing.app.Preferences; */ public class PdeInputHandler extends DefaultInputHandler { - public PdeInputHandler() { + /** + * Need the Editor object for Input Method changes, plus most subclasses + * will want a local copy anyway. Changed after Processing 3.1.2, need to + * see if this breaks any other Modes before releasing. + */ + protected Editor editor; + + + public PdeInputHandler(Editor editor) { + this.editor = editor; + // Use option on mac for text edit controls that are ctrl on Windows/Linux. // (i.e. ctrl-left/right is option-left/right on OS X) String mod = Platform.isMacOS() ? "A" : "C"; @@ -253,4 +264,9 @@ public class PdeInputHandler extends DefaultInputHandler { public boolean handleTyped(KeyEvent event) { return false; } + + + public void handleInputMethodCommit() { + editor.getSketch().setModified(true); + } } \ No newline at end of file diff --git a/app/src/processing/app/ui/Editor.java b/app/src/processing/app/ui/Editor.java index dd445f4fc..0c713d181 100644 --- a/app/src/processing/app/ui/Editor.java +++ b/app/src/processing/app/ui/Editor.java @@ -389,7 +389,7 @@ public abstract class Editor extends JFrame implements RunnerListener { protected JEditTextArea createTextArea() { return new JEditTextArea(new PdeTextAreaDefaults(mode), - new PdeInputHandler()); + new PdeInputHandler(this)); } @@ -1770,7 +1770,7 @@ public abstract class Editor extends JFrame implements RunnerListener { startCompoundEdit(); super.beginCompoundEdit(); } - + @Override public void endCompoundEdit() { stopCompoundEdit(); @@ -1805,7 +1805,7 @@ public abstract class Editor extends JFrame implements RunnerListener { if (!isInserting && !textarea.isOverwriteEnabled() && isDirectEdit()) { endTextEditHistory(); } - + if (!textarea.isOverwriteEnabled()) { isInserting = true; } diff --git a/java/src/processing/mode/java/JavaInputHandler.java b/java/src/processing/mode/java/JavaInputHandler.java index 596f35063..9e3ae5912 100644 --- a/java/src/processing/mode/java/JavaInputHandler.java +++ b/java/src/processing/mode/java/JavaInputHandler.java @@ -40,7 +40,6 @@ import java.util.Arrays; * continuing to hack this class. */ public class JavaInputHandler extends PdeInputHandler { - private Editor editor; /** ctrl-alt on windows and linux, cmd-alt on mac os x */ static final int CTRL_ALT = ActionEvent.ALT_MASK | @@ -48,7 +47,7 @@ public class JavaInputHandler extends PdeInputHandler { public JavaInputHandler(Editor editor) { - this.editor = editor; + super(editor); } @@ -334,12 +333,6 @@ public class JavaInputHandler extends PdeInputHandler { } - @Override - public void handleInputMethodCommit() { - editor.getSketch().setModified(true); - } - - /** * Return the index for the first character on this line. */ diff --git a/todo.txt b/todo.txt index 137bfdec7..ced871853 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,6 @@ 0252 (3.1.3?) +X change PdeInputHandler constructor +_ check whether this breaks other Modes before releasing _ modify line number color when no lines extend that far? _ https://github.com/processing/processing/pull/4560 _ text gutter doesn't seem to be hidpi