If TextArea1.SelectionLength is negative Quit is disabled

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.

Xojo: 2021r1.1
macOS: Big Sur 11.3.1
MacBook Pro M1

Because no one chime in, I checked this and I can confirm what I wrote above.

Here’s the full code:

// a. Set some text to TextArea1
TextArea1.Text = "TextArea: here's some text for testing."

// b. Select some text with a “negative” value
TextArea1.SelectionStart  = 15 // Some value
TextArea1.SelectionLength = TextArea1.SelectionStart - 31 // Wrong value

feedback://showreport?report_id=64778

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.