@@ -1018,7 +1018,7 @@ end textReplaceRawInVariable
10181018# This is the raw replacement operation that performs a mutation on the script field without
10191019# saving any undo information. This should be called only from inside textReplace, when doing an undo or a redo
10201020# and when setting the script when a new object is loaded.
1021- private command textReplaceRaw pOffset, @pOldText, @pNewText, pDontUpdateBreakpoints
1021+ private command textReplaceRaw pOffset, @pOldText, @pNewText, pDontUpdateBreakpoints, pUpdateBreakpointsNow
10221022 lock screen
10231023 lock messages
10241024
@@ -1044,15 +1044,14 @@ private command textReplaceRaw pOffset, @pOldText, @pNewText, pDontUpdateBreakpo
10441044 add 1 to tNewLines
10451045 end if
10461046 end if
1047+ unlock messages
10471048
10481049 if pDontUpdateBreakpoints then
1049- updateGutterRequest empty , empty , tOldLines , tNewLines , false , false
1050+ updateGutterRequest empty , empty , tOldLines , tNewLines , false , false , false , pUpdateBreakpointsNow
10501051 else
1051- updateGutterRequest pOffset , tSelectedLine , tOldLines , tNewLines , true , false
1052+ updateGutterRequest pOffset , tSelectedLine , tOldLines , tNewLines , true , false , false , pUpdateBreakpointsNow
10521053 end if
10531054
1054- unlock messages
1055-
10561055 # OK-2008-09-10 : Bug 7132 - Update the panes and handler list everytime the text of the field is changed.
10571056 # OK-2009-01-19 : Don't do this here as it slows down the script editor on OS X. Instead do it in the individual
10581057 # cases where it may be needed, cut, paste, return, delete, backspace, undo and redo
@@ -1086,12 +1085,13 @@ on textUndo
10861085
10871086 local tOperations
10881087 put sTextGroupLengths [sObjectId ,sTextGroupIndex [sObjectId ]] into tOperations
1088+
10891089 lock screen
10901090 repeat with tIndex = sTextOperationIndex [sObjectId ] down to sTextOperationIndex [sObjectId ] - tOperations + 1
10911091 local tNewText , tOldText
10921092 put sTextOperationNewTexts [sObjectId ,tIndex ] into tNewText
10931093 put sTextOperationOldTexts [sObjectId ,tIndex ] into tOldText
1094- textReplaceRaw sTextOperationOffsets [sObjectId ,tIndex ], tNewText , tOldText
1094+ textReplaceRaw sTextOperationOffsets [sObjectId ,tIndex ], tNewText , tOldText , false , true
10951095 end repeat
10961096 unlock screen
10971097
@@ -1123,7 +1123,7 @@ on textRedo
11231123 local tNewText , tOldText
11241124 put sTextOperationOldTexts [sObjectId ,tIndex ] into tOldText
11251125 put sTextOperationNewTexts [sObjectId ,tIndex ] into tNewText
1126- textReplaceRaw sTextOperationOffsets [sObjectId ,tIndex ], tOldText , tNewText
1126+ textReplaceRaw sTextOperationOffsets [sObjectId ,tIndex ], tOldText , tNewText , false , true
11271127 end repeat
11281128 unlock screen
11291129
@@ -1235,6 +1235,12 @@ end getUpdateGutterRequestDetails
12351235# mutable objects (the breakpoint / compilation error images). These are show again when the update is
12361236# actually carried out.
12371237command updateGutterRequest pOffset, pSelectedLine, pOldLines, pNewLines, pTextChanged, pUpdateCompilationErrors, pForceBreakpointRedraw, pNow
1238+ if sGutterUpdateRequestDetails ["offset" ] is not empty and \
1239+ pOffset is not sGutterUpdateRequestDetails ["offset" ] then
1240+ -- if the offset is different we can't merge
1241+ updateGutterDo
1242+ end if
1243+
12381244 updateGutterMergeRequestDetails pOffset , pSelectedLine , pOldLines , pNewLines , pTextChanged , pUpdateCompilationErrors , pForceBreakpointRedraw
12391245 if sGutterUpdateRequest is not empty then
12401246 cancel sGutterUpdateRequest
@@ -1248,7 +1254,7 @@ command updateGutterRequest pOffset, pSelectedLine, pOldLines, pNewLines, pTextC
12481254 set the vScroll of field "Numbers" of group "Gutter" to the vScroll of field "Script" of me
12491255 end if
12501256
1251- if pNow then
1257+ if pNow or ( pOldLines is not 1 or pNewLines is not 1 ) then
12521258 updateGutterDo
12531259 else
12541260 send "updateGutterDo" to me in 200 milliseconds
@@ -2071,7 +2077,7 @@ on scrollBarDrag
20712077 lock screen
20722078 put tVScroll into sVScroll
20732079
2074- updateGutterRequest empty , empty , empty , empty , false , true , empty , true
2080+ updateGutterRequest empty , empty , empty , empty , false , true , false , true
20752081 unlock screen
20762082end scrollBarDrag
20772083
@@ -2878,7 +2884,7 @@ command scriptComment
28782884 delete the last char of tCommentedText
28792885
28802886 # Apply the mutation to the field
2881- textMark "Insert "
2887+ textBeginGroup "Comment "
28822888 textReplace tStartChar , tText , tCommentedText
28832889
28842890 # Restore the selection
@@ -2891,8 +2897,9 @@ command scriptComment
28912897 put __GetPreference("editor,autoformat" , true ) into tAutoFormat
28922898
28932899 if tAutoFormat then
2894- scriptFormat "handler"
2900+ scriptFormat "handler" , true
28952901 end if
2902+ textEndGroup
28962903
28972904 unlock screen
28982905end scriptComment
@@ -2941,7 +2948,7 @@ command scriptUncomment
29412948 delete the last char of tUncommentedText
29422949
29432950 # Apply the mutation to the field
2944- textMark "Insert "
2951+ textBeginGroup "Uncomment "
29452952 textReplace tStartChar , tText , tUncommentedText
29462953
29472954 # Restore the selection
@@ -2954,8 +2961,9 @@ command scriptUncomment
29542961 put __GetPreference("editor,autoformat" , true ) into tAutoFormat
29552962
29562963 if tAutoFormat then
2957- scriptFormat "handler"
2964+ scriptFormat "handler" , true
29582965 end if
2966+ textEndGroup
29592967
29602968 unlock screen
29612969end scriptUncomment
0 commit comments