In SD8, when searching for or selecting some text, if the text is highlighted and the Escape key is pressed, sometimes a list of alternative words is displayed e.g.:
When that happens, there appears to be no way to NOT replace the selected text. If I press Escape again, the selected text is replaced with the word at the top of the list. Same if I press Tab or if I click away. If I press any other key, that replaces the selected text. If the word at the top of the list is the same as the selected word, the selected word is replaced with a space character. Only fix I’ve found is to command-z to undo the substitution.
I think this is the “Code Completion” function. The Escape key doesn’t seem to dismiss the “find bar”. Same with the F5 key. Instead of cancelling the completion, it does the substitution.
This has caused me some grief when I’ve not noticed the substitution and I have to scan my code to find the cause of a new error. In practice I use the Escape key as little as possible while editing to reduce the risk of unwanted substitutions. I can’t find a key binding so as to remove the Esc key from the Code Completion function.
Is there a way to turn off this behaviour or to remove the key binding for “Esc” ?
I can’t reproduce that behaviour. If you press Esc or F5 a second time, the original text should be restored. The one glitch is that the case of the text may change.
Apart from the key assignment, this is standard system behaviour, not specific to Script Debugger. Do you see the same issue in TextEdit when you press the F5 key a second time?
I tried in Pages and TextEdit and did not see this behaviour. In Pages and TextEdit, the substitution list is not shown under the selected text but in the find box.
Done some more testing in SD8:
Esc does close the find bar but only if it is active - I guess that’s normal and I can’t remember what I was doing earlier today when it did not close;
If text is selected and the find box is not showing, the Esc key will display a list of substitutions and a second Esc key will blank or replace as I reported – however, not for all selected text - seems to show substitution list only in some cases;
if a find locates text and user then makes find box inactive by clicking away and then pressing command-g, I get the behaviour reported.
So, one set of steps to get the behaviour:
select some text “buttonName” in Dialog Toolkit Plus.scptd is a good example;
press the Esc key;
Substitution list is displayed under the selected text but may have only one entry the same as the selected text;
press Esc;
selected text is deleted or changed.
I can try to do some more testing but, I’m pressed for time at present.
I’m not sure there’s anything particularly surprising there. Showing dialogs from Dialog Toolkit is essentially a hack – they are windows belonging to Script Debugger, but it has no control over how they are set up or interact with other UI elements.
Sorry, I think I mislead you. This is not related to DTP – I used DTP as example text because I know the substitution list will be shown if “buttonName” is selected and the Esc key pressed.
I will try to create a screen recording which shows the behaviour – tomorrow.
Thanks.
UPDATE: I have a screen recording showing an example of what I’ve described. In this example, there is no find box active or inactive.
The word “dialog” was replaced with the suggestion “dialog reply”.
Pressed Esc again and “dialog reply” was replaced with “dialog” – however, it was no longer compiled.
Second, I select a variable name.
Pressed Esc.
the substitution list was displayed.
pressed Esc again.
the text “theVariable” was cut.
“theVariable” is also cut if I click away. Pressing tab changes the substitution list.
Pressing F5 instead of Esc has the same behaviour in SD8. I have not seen that behaviour in Pages or TextEdit. In TexEdit, pressing F5 the second time returns the original selected text - i.e. does not cut the selected text. However, pressing TAB or clicking away does change the selected text which I guess is considered normal. Pressing Esc does nothing.
Anyway, I’m hoping there is a way of SD8 behaviour being made the same as TextEdit/Pages or enable the user to change the assignment for the Esc key.