@@ -846,7 +846,7 @@ end textReplaceNewGroupNeeded
846846# This is the point through which all standard editing operations on scripts are sent through.
847847# Any change made via this function will be added to the undo system. This is called when the
848848# user types keys, formats text, cuts, pastes etc.
849- command textReplace pOffset, pOldText, pNewText, pObject, pDontGroup
849+ command textReplace pOffset, pOldText, pNewText, pObject, pDontGroup, pDontSelect
850850 lock screen
851851
852852 local tObject
@@ -943,27 +943,33 @@ command textReplace pOffset, pOldText, pNewText, pObject, pDontGroup
943943 end repeat
944944 put true into sPlaceholders [sEditPlaceholder ]["edited" ]
945945
946- if tSelection is not empty then
947- select tSelection
948- else if pNewText is empty then
949- select char pOffset to pOffset - 1 of field "script" of me
950- else if the length of pNewText is 1 then
951- select char pOffset + 1 to pOffset of field "script" of me
952- else if tBracketCompletionType is "pair" then
953- select after char pOffset of field "script" of me
946+ if not pDontSelect then
947+ if tSelection is not empty then
948+ select tSelection
949+ else if pNewText is empty then
950+ select char pOffset to pOffset - 1 of field "script" of me
951+ else if the length of pNewText is 1 then
952+ select char pOffset + 1 to pOffset of field "script" of me
953+ else if tBracketCompletionType is "pair" then
954+ select after char pOffset of field "script" of me
955+ end if
954956 end if
955957 else
956958 -- clear highlighted bracket background color
957959 __ClearHighlights
958960 textReplaceRaw pOffset , pOldText , pNewText
959- if tSelection is not empty then
960- select tSelection
961- else if tBracketCompletionType is "pair" then
962- select after char pOffset of field "script" of me
961+ if not pDontSelect then
962+ if tSelection is not empty then
963+ select tSelection
964+ else if tBracketCompletionType is "pair" then
965+ select after char pOffset of field "script" of me
966+ end if
963967 end if
964968 end if
965969
966- selectionUpdateRequest
970+ if not pDontSelect then
971+ selectionUpdateRequest
972+ end if
967973
968974 -- when formatting or pasting we don't want autocomplete to pop up
969975 if the number of lines of pNewText <= 1 then
@@ -3455,6 +3461,10 @@ end __UpdateAutoCompleteList
34553461
34563462private command __ClearCurrentPlaceholder pForce
34573463 if not pForce then
3464+ if the selectedField is empty or \
3465+ the long id of the selectedField is not the long id of field "script" of me then
3466+ exit __ClearCurrentPlaceholder
3467+ end if
34583468 local tChunk
34593469 put the selectedChunk into tChunk
34603470 if exists(tChunk ) then
0 commit comments