Fixes for breakpoint management when editing the code.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 08 May 2014 15:05:08 +0200
changeset 14328 9510671ea784
parent 14327 195c096a4cc8
child 14329 183380e95bac
Fixes for breakpoint management when editing the code.
Tools__BreakpointService.st
--- a/Tools__BreakpointService.st	Thu May 08 14:52:16 2014 +0200
+++ b/Tools__BreakpointService.st	Thu May 08 15:05:08 2014 +0200
@@ -83,12 +83,6 @@
     "Created: / 22-07-2013 / 14:01:17 / cg"
 ! !
 
-!BreakpointService methodsFor:'accessing'!
-
-breakpoints
-    ^ breakpoints
-! !
-
 !BreakpointService methodsFor:'change & update'!
 
 update: aspect with: param from: sender
@@ -189,7 +183,7 @@
 
     key == #Accept ifTrue:[ 
         textView undoableDo:[
-            BreakpointQuery answer: breakpoints do:[
+            BreakpointQuery answer: self breakpoints do:[
                 textView accept.
             ].
         ].
@@ -198,6 +192,7 @@
     ^ false
 
     "Created: / 08-05-2014 / 10:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-05-2014 / 13:52:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 linesDeletedFrom: start to: end
@@ -277,13 +272,32 @@
     "Modified (format): / 05-07-2011 / 21:33:23 / cg"
 !
 
+breakpoints
+    "/ Fixup breakpoint positions
+    self fixupBreakpointPositions.
+    ^ breakpoints
+
+    "Modified: / 08-05-2014 / 14:02:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fixupBreakpointPositions
+    breakpoints notEmptyOrNil ifTrue:[ 
+       breakpoints do:[:each |  
+           | pos |
+
+           pos := textView characterPositionOfLine: each line col:1.
+           each position: pos.  
+       ]
+   ].
+
+    "Created: / 08-05-2014 / 14:02:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 moveBreakpointsAfterLine:line by: delta
-    |pos |
-
     breakpoints do:[:bpnt|
         bpnt line >= line ifTrue:[
-            pos := textView characterPositionOfLine:bpnt line + delta col:1.
-            bpnt position:pos line:(bpnt line + delta). 
+            "/ Note that position will be fixed up in BreakpointService>>breakpoints
+            bpnt position:nil line:(bpnt line + delta). 
         ]
     ].
 
@@ -292,6 +306,7 @@
     "Created: / 17-06-2011 / 13:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Created: / 06-07-2011 / 17:26:30 / jv"
     "Modified: / 02-08-2012 / 09:27:10 / cg"
+    "Modified: / 08-05-2014 / 14:01:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 recompile
@@ -308,6 +323,7 @@
             ^self.
         ] ifFalse:[
             "/ prepare to get reachable bpts
+            self fixupBreakpointPositions.
             breakpoints do:[:bp | bp isReached:false].
 
             class := oldMethod mclass.
@@ -391,8 +407,8 @@
     ]
 
     "Created: / 05-07-2011 / 21:33:13 / cg"
-    "Modified: / 18-07-2012 / 10:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 22-07-2013 / 16:00:13 / cg"
+    "Modified: / 08-05-2014 / 14:03:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 setOrToggleBreakpointAtLine:line
@@ -627,14 +643,14 @@
 !BreakpointService class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.46 2014-05-08 11:26:48 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.47 2014-05-08 13:05:08 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.46 2014-05-08 11:26:48 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.47 2014-05-08 13:05:08 vrany Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__BreakpointService.st,v 1.46 2014-05-08 11:26:48 vrany Exp $'
+    ^ '$Id: Tools__BreakpointService.st,v 1.47 2014-05-08 13:05:08 vrany Exp $'
 ! !