From 54403bd4de3854e08c5465a632dd39a850db165e Mon Sep 17 00:00:00 2001 From: benfry Date: Fri, 21 Dec 2012 16:55:31 +0000 Subject: [PATCH] This patch fixes a serious bug that was causing the Debugger to point to wrong (break point) line numbers. --- .../processing/mode/experimental/ErrorBar.java | 2 -- .../mode/experimental/ErrorCheckerService.java | 16 +--------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/pdex/src/processing/mode/experimental/ErrorBar.java b/pdex/src/processing/mode/experimental/ErrorBar.java index b66c34543..ece0cb5d1 100755 --- a/pdex/src/processing/mode/experimental/ErrorBar.java +++ b/pdex/src/processing/mode/experimental/ErrorBar.java @@ -162,8 +162,6 @@ public class ErrorBar extends JPanel { int currentTab = 0; for (SketchCode sc : editor.getSketch().getCode()) { if (sc.isExtension("pde")) { - sc.setPreprocOffset(bigCount); - try { if (editor.getSketch().getCurrentCode().equals(sc)) { // Adding + 1 to len because \n gets appended diff --git a/pdex/src/processing/mode/experimental/ErrorCheckerService.java b/pdex/src/processing/mode/experimental/ErrorCheckerService.java index 85a8b84a5..e07791ebc 100755 --- a/pdex/src/processing/mode/experimental/ErrorCheckerService.java +++ b/pdex/src/processing/mode/experimental/ErrorCheckerService.java @@ -73,11 +73,6 @@ public class ErrorCheckerService implements Runnable{ */ protected URL[] classpath; - /** - * P5 Preproc offset - */ - private int scPreProcOffset = 0; - /** * Stores all Problems in the sketch */ @@ -656,7 +651,7 @@ public class ErrorCheckerService implements Runnable{ * Repaints the textarea if required */ public void updateTextAreaPainter() { - // TODO: Make this fucntion of some use + // TODO: Make this function of some use editor.getTextArea().repaint(); currentTab = editor.getSketch().getCodeIndex( editor.getSketch().getCurrentCode()); @@ -705,7 +700,6 @@ public class ErrorCheckerService implements Runnable{ public int[] calculateTabIndexAndLineNumber(IProblem problem) { // String[] lines = {};// = PApplet.split(sourceString, '\n'); int codeIndex = 0; - int bigCount = 0; int x = problem.getSourceLineNumber() - mainClassOffset; if (x < 0) { @@ -730,7 +724,6 @@ public class ErrorCheckerService implements Runnable{ try { for (SketchCode sc : editor.getSketch().getCode()) { if (sc.isExtension("pde")) { - sc.setPreprocOffset(bigCount); int len = 0; if (editor.getSketch().getCurrentCode().equals(sc)) { len = Base.countLines(sc.getDocument().getText(0, @@ -769,7 +762,6 @@ public class ErrorCheckerService implements Runnable{ } } - bigCount += sc.getLineCount(); } } catch (Exception e) { System.err @@ -804,14 +796,10 @@ public class ErrorCheckerService implements Runnable{ for (SketchCode sc : editor.getSketch().getCode()) { if (sc.isExtension("pde")) { - sc.setPreprocOffset(scPreProcOffset); - try { if (editor.getSketch().getCurrentCode().equals(sc)) { - // rawCode.append(sc.getDocument().getText(0, - // sc.getDocument().getLength())); rawCode.append(scrapImportStatements(sc.getDocument() .getText(0, sc.getDocument() @@ -820,7 +808,6 @@ public class ErrorCheckerService implements Runnable{ .getCodeIndex(sc))); } else { - // rawCode.append(sc.getProgram()); rawCode.append(scrapImportStatements(sc.getProgram(), editor .getSketch().getCodeIndex(sc))); @@ -831,7 +818,6 @@ public class ErrorCheckerService implements Runnable{ + e.toString()); } rawCode.append('\n'); - scPreProcOffset += sc.getLineCount(); } }