1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-20 14:54:31 +01:00

Made the Mangler file compile again

The .getCurrentTab() was missing, and for some reason it wouldn't compile with the isSelectionActive() , while I did find the file in https://github.com/arduino/Arduino/blob/master/app/src/processing/app/syntax/SketchTextArea.java . But at least people can compile it after these changes
This commit is contained in:
Geert Roumen 2018-10-05 00:24:27 +02:00 committed by Cristian Maglie
parent afc0e0240e
commit 799879e8ae

View File

@ -32,6 +32,7 @@ import processing.app.Editor;
import processing.app.tools.Tool;
/**
* Example Tools menu entry.
*/
@ -69,8 +70,9 @@ public class Mangler implements Tool {
protected void mangleSelection() {
if (editor.isSelectionActive()) {
String selection = editor.getSelectedText();
//Check if there is selected text
if (editor.getCurrentTab().getSelectedText() != null) {
String selection = editor.getCurrentTab().getSelectedText();
char[] stuff = selection.toCharArray();
// Randomly swap a bunch of characters in the text
for (int i = 0; i < stuff.length / 10; i++) {
@ -82,13 +84,12 @@ public class Mangler implements Tool {
stuff[a] = selection.charAt(b);
stuff[b] = selection.charAt(a);
}
editor.startCompoundEdit();
editor.setSelectedText(new String(stuff));
editor.stopCompoundEdit();
editor.getCurrentTab().setSelectedText(new String(stuff));
editor.statusNotice("Now that feels better, doesn't it?");
} else {
editor.statusError("No selection, no dice.");
//When there is no selected text
editor.statusError("No selection, no dice.");
}
}
}