don't insert a space when typing ctrl-space (fixes #3847)

This commit is contained in:
Ben Fry
2015-09-21 19:35:21 -04:00
parent fc3e006772
commit 557bae9e4f
2 changed files with 16 additions and 17 deletions

View File

@@ -324,6 +324,11 @@ public class JavaInputHandler extends PdeInputHandler {
event.consume();
return true;
}
// https://github.com/processing/processing/issues/3847
if (c == KeyEvent.VK_SPACE) {
event.consume();
return true;
}
}
return false;
}

View File

@@ -269,28 +269,22 @@ public class JavaTextArea extends JEditTextArea {
} else if (keyChar == ' ') { // Trigger on Ctrl-Space
if (!Platform.isMacOS() && JavaMode.codeCompletionsEnabled &&
(event.isControlDown() || event.isMetaDown())) {
//SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
// protected Object doInBackground() throws Exception {
// Provide completions only if it's enabled
if (JavaMode.codeCompletionsEnabled) {
try {
getDocument().remove(getCaretPosition() - 1, 1); // Remove the typed space
Messages.log("[KeyEvent]" + event.getKeyChar() + " |Prediction started");
fetchPhrase();
} catch (BadLocationException e) {
e.printStackTrace();
}
}
// return null;
// }
//};
//worker.execute();
// Provide completions only if it's enabled
if (JavaMode.codeCompletionsEnabled) {
// Removed for https://github.com/processing/processing/issues/3847
//try {
// getDocument().remove(getCaretPosition() - 1, 1); // Remove the typed space
Messages.log("[KeyEvent]" + event.getKeyChar() + " |Prediction started");
fetchPhrase();
//} catch (BadLocationException e) {
// e.printStackTrace();
//}
}
} else {
hideSuggestion(); // hide on spacebar
}
} else {
if (JavaMode.codeCompletionsEnabled) {
//fetchPhrase();
prepareSuggestions(event);
}
}