Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit d61f964

Browse files
committed
[[ Bug ]] Group comment & format operations
This patch groups the comment/uncomment and format operations into one so that undo/redo will appear as one operation rather than two.
1 parent 83ee531 commit d61f964

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Toolset/palettes/script editor/behaviors/revsecommoneditorbehavior.livecodescript

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,7 +2884,7 @@ command scriptComment
28842884
delete the last char of tCommentedText
28852885

28862886
# Apply the mutation to the field
2887-
textMark "Insert"
2887+
textBeginGroup "Comment"
28882888
textReplace tStartChar, tText, tCommentedText
28892889

28902890
# Restore the selection
@@ -2897,8 +2897,9 @@ command scriptComment
28972897
put __GetPreference("editor,autoformat", true) into tAutoFormat
28982898

28992899
if tAutoFormat then
2900-
scriptFormat "handler"
2900+
scriptFormat "handler", true
29012901
end if
2902+
textEndGroup
29022903

29032904
unlock screen
29042905
end scriptComment
@@ -2947,7 +2948,7 @@ command scriptUncomment
29472948
delete the last char of tUncommentedText
29482949

29492950
# Apply the mutation to the field
2950-
textMark "Insert"
2951+
textBeginGroup "Uncomment"
29512952
textReplace tStartChar, tText, tUncommentedText
29522953

29532954
# Restore the selection
@@ -2960,8 +2961,9 @@ command scriptUncomment
29602961
put __GetPreference("editor,autoformat", true) into tAutoFormat
29612962

29622963
if tAutoFormat then
2963-
scriptFormat "handler"
2964+
scriptFormat "handler", true
29642965
end if
2966+
textEndGroup
29652967

29662968
unlock screen
29672969
end scriptUncomment

0 commit comments

Comments
 (0)