Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -221,6 +222,11 @@ public void run() {
});
}

/**
* checkCode() only on text area update
*/
protected AtomicInteger textModified = new AtomicInteger(0);

public void run() {
stopThread = false;

Expand All @@ -237,12 +243,18 @@ public void run() {
if (pauseThread)
continue;

if(textModified.get() == 0)
continue;

// Check every x seconds
checkCode();

}
}




private boolean checkCode() {

lastTimeStamp = System.currentTimeMillis();
Expand Down Expand Up @@ -270,6 +282,17 @@ private boolean checkCode() {
editor.updateErrorBar(problemsList);
updateEditorStatus();
updateTextAreaPainter();
int x = textModified.get();
//System.out.println("TM " + x);
if(x>=3){
textModified.set(3);
x = 3;
}

if(x>0)
textModified.set(x - 1);
else
textModified.set(0);
return true;

} catch (Exception e) {
Expand Down
12 changes: 11 additions & 1 deletion experimental/src/processing/mode/experimental/TextArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.awt.Cursor;
import java.awt.FontMetrics;
import java.awt.event.ComponentListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
Expand Down Expand Up @@ -50,6 +51,7 @@ public class TextArea extends JEditTextArea {
protected Map<Integer, String> gutterText = new HashMap(); // maps line index to gutter text
protected Map<Integer, Color> gutterTextColors = new HashMap(); // maps line index to gutter text color
protected TextAreaPainter customPainter;
protected ErrorCheckerService errorCheckerService;

public TextArea(TextAreaDefaults defaults, DebugEditor editor) {
super(defaults);
Expand Down Expand Up @@ -99,7 +101,15 @@ public TextArea(TextAreaDefaults defaults, DebugEditor editor) {
*/
public void setECSandThemeforTextArea(ErrorCheckerService ecs, ExperimentalMode mode)
{
customPainter.setECSandTheme(ecs, mode);
errorCheckerService = ecs;
customPainter.setECSandTheme(ecs, mode);
}

public void processKeyEvent(KeyEvent evt) {
super.processKeyEvent(evt);
if(evt.getID() == KeyEvent.KEY_TYPED){
errorCheckerService.textModified.incrementAndGet();
}
}

/**
Expand Down