Workaround for disappearing breakpoint icons after editing source code.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 05 Jun 2014 15:56:42 +0200
changeset 14456 218e0f00e309
parent 14455 2cf7e6a773bb
child 14457 75bcb6c122a7
Workaround for disappearing breakpoint icons after editing source code. When a line(s) with breakpoint is deleted, delete that breakpoint too instead and move only those after deleted line(s).
Tools__BreakpointService.st
--- a/Tools__BreakpointService.st	Thu Jun 05 01:51:35 2014 +0200
+++ b/Tools__BreakpointService.st	Thu Jun 05 15:56:42 2014 +0200
@@ -122,10 +122,19 @@
         currentMethodClass := nil
     ].
     breakpoints := methodsBreakPoints.
+    breakpoints notNil ifTrue:[ 
+        "/ Nil out breakpoint's position. It's invalid as soon as
+        "/ user edits the code. Instead, depend on line information.
+        "/ Breakpoint character positions are fixed up just before
+        "/ passing a breakpoints to the compiler, see
+        "/ #fixupBreakpointPositions
+        breakpoints do:[:each | each position: nil ].
+    ].
     currentMethod := aMethod.
 
     "Created: / 06-07-2011 / 15:24:09 / cg"
     "Modified: / 06-07-2011 / 17:32:54 / jv"
+    "Modified: / 05-06-2014 / 14:45:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 updateCurrentMethod
@@ -196,11 +205,21 @@
 !
 
 linesDeletedFrom: start to: end
+    | breakpointsToRemove |
 
     breakpoints isEmptyOrNil ifTrue:[^self].
-    self moveBreakpointsAfterLine: start - 1 by: (end - start + 1) negated
+    breakpointsToRemove := Set new.
+    start to: end do:[:line | 
+        | breakpointToRemove |
+
+        breakpointToRemove := self breakpointAtLine: line.
+        breakpointToRemove notNil ifTrue:[ breakpointsToRemove add: breakpointToRemove ].
+    ].
+    breakpoints removeAll: breakpointsToRemove.
+    self moveBreakpointsAfterLine: end by: (end - start + 1) negated
 
     "Created: / 06-07-2011 / 17:16:27 / jv"
+    "Modified: / 04-06-2014 / 17:56:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 linesInsertedFrom: start to: end
@@ -645,14 +664,14 @@
 !BreakpointService class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.49 2014-06-04 16:38:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.50 2014-06-05 13:56:42 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.49 2014-06-04 16:38:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.50 2014-06-05 13:56:42 vrany Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__BreakpointService.st,v 1.49 2014-06-04 16:38:55 cg Exp $'
+    ^ '$Id: Tools__BreakpointService.st,v 1.50 2014-06-05 13:56:42 vrany Exp $'
 ! !