Skip to content

Commit 799879e

Browse files
lemiocmaglie
authored andcommittedNov 5, 2018
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
·
1.8.191.8.8
1 parent afc0e02 commit 799879e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed
 

‎build/shared/tools/Mangler/src/Mangler.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import processing.app.tools.Tool;
3333

3434

35+
3536
/**
3637
* Example Tools menu entry.
3738
*/
@@ -69,8 +70,9 @@ public void run() {
6970

7071

7172
protected void mangleSelection() {
72-
if (editor.isSelectionActive()) {
73-
String selection = editor.getSelectedText();
73+
//Check if there is selected text
74+
if (editor.getCurrentTab().getSelectedText() != null) {
75+
String selection = editor.getCurrentTab().getSelectedText();
7476
char[] stuff = selection.toCharArray();
7577
// Randomly swap a bunch of characters in the text
7678
for (int i = 0; i < stuff.length / 10; i++) {
@@ -82,13 +84,12 @@ protected void mangleSelection() {
8284
stuff[a] = selection.charAt(b);
8385
stuff[b] = selection.charAt(a);
8486
}
85-
editor.startCompoundEdit();
86-
editor.setSelectedText(new String(stuff));
87-
editor.stopCompoundEdit();
87+
editor.getCurrentTab().setSelectedText(new String(stuff));
8888
editor.statusNotice("Now that feels better, doesn't it?");
8989

9090
} else {
91-
editor.statusError("No selection, no dice.");
91+
//When there is no selected text
92+
editor.statusError("No selection, no dice.");
9293
}
9394
}
9495
}

0 commit comments

Comments
 (0)
Please sign in to comment.