Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error if cursor is at the last character (empty new line) of a file #1

Open
benjaminkraus opened this issue Dec 18, 2023 · 1 comment

Comments

@benjaminkraus
Copy link

If your cursor is located at the very last line of your function, which happens to be an empty line, you can get an error from within ConnectButtonPushed function, on this line of code:

codeLine = txt(pos1:pos2);

In my case, pos2 was 61 but the size of txt was only 60 characters, so I got the error: "Index exceeds the number of array elements. Index must not exceed 60."

I can't tell if the bug is actually within positionInLineToIndex (which is returning a value past the end of the file), but ConnectButtonPushed should have a check for out-of-bounds positions.

@gulley
Copy link
Owner

gulley commented Dec 19, 2023

Thanks for reporting this. It is puzzling that positionInLineToIndex will return something that is outside the bounds of text. I have protected against that now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants