From 8f3c54d8ba741fc119321002199e763291a02130 Mon Sep 17 00:00:00 2001
From: Geert Roumen <geert.roumen@gmail.com>
Date: Fri, 5 Oct 2018 00:24:27 +0200
Subject: [PATCH] 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
---
 build/shared/tools/Mangler/src/Mangler.java | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/build/shared/tools/Mangler/src/Mangler.java b/build/shared/tools/Mangler/src/Mangler.java
index cfd52795498..e30250f1030 100644
--- a/build/shared/tools/Mangler/src/Mangler.java
+++ b/build/shared/tools/Mangler/src/Mangler.java
@@ -32,6 +32,7 @@
 import processing.app.tools.Tool;
 
 
+
 /**
  * Example Tools menu entry.
  */
@@ -69,8 +70,9 @@ public void run() {
 
 
   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 @@ protected void mangleSelection() {
         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.");
     }
   }
 }