When the TextArea.Text scan is at the end of the Text*, and because I do not tested against this case, I pass a negative value ** to TextArea1.SelectionLength.
This disable the Quit feature (running in the IDE).
Nota: I press the Tab key to get there (the Tab key is not inserted in the TextArea)
- The scan search an EndOfLine character and do not found one (the TextArea.Text ends on a standard character, not an EndOfLine).
** The SelectionLenght is set as follows:
SelectionLenght = PosEnd - PosStart
The code is in the KeyUp Event of a TextArea Sub Class.
macOS: Big Sur 11.3.1
MacBook Pro M1