mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 06:09:17 +01:00
don't insert a space when typing ctrl-space (fixes #3847)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user