-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Ropey char index out of bounds panic #12461
Comments
Hm... I can't reproduce this on the latest master. |
Sorry, realised that I forgot to mention the selection collapse before inserting return. (Visible in the asciinema though.) You're correct in that it does not reproduce the error if left out. |
Hm even if I collapse the selection (I hope we talk about the same by pressing recording-2025-01-09_19.39.20.mp4 |
Yeah, `;' should be right. (I've got mine bound to escape.) How did you paste in the snippet? I think you need to paste it on an "EOF line that does not yet exist". See how I in the recording paste it at the |
Alright, so here's a full video of my steps: recording-2025-01-09_19.53.19.mp4I'm currently on the master branch. May I ask if you can try the latest master branch as well? |
Still not pasting onto the last line. Notice how I go down one line down in my recording before pasting. 😊 No, official release, as mentioned in the top comment. |
Ok, so this issue is also related to #12495. I managed to fix it in #12510 When I solved my issue, that was most of the story. But there was still a bug which I wouldn't have found if not for your issue. When I came across this issue, I tried your example, and found the bug that my PR would've introduced. The bug I fixed in 903b10d, it's a very small change but that also means it can be really hard to figure out. So I added your input to the integration test suite, and it works now! |
My man, thank you! |
helix-editor#12177 changed `insert_newline`'s behavior to trim any trailing whitespace on a line which came before a cursor. `insert_newline` would previously never delete text. Even the whitespace stripping behavior in helix-editor#4854 worked by inserting text - a line ending at the beginning of the line. `global_offs`, a variable that tracks the number of characters inserted between iterations over the existing selection ranges, was not updated to also account for text deleted by the trimming behavior, causing cursors to be offset by the amount of trailing space deleted and causing panics in some cases. To fix this we need to subtract the number of trimmed whitespace characters from `global_offs`. `global_offs` must become an `isize` (was a `usize`) because it may become negative in cases where a lot of trailing whitespace is trimmed. Integration tests have been added for each of these cases. Fixes helix-editor#12461 Fixes helix-editor#12495 Fixes helix-editor#12539
Summary
Getting a panic when copying some EBNF from a PDF and then inserting some newlines into it. (https://standards.scheme.org/official/r7rs.pdf p. 62 if it helps.)
Reproduction Steps
Tried to enter a newline at every
|
after pasting the following:https://asciinema.org/a/gIJF8EpZ9wTsOGTxHWbX7NKgk
Helix log
Stderr
Logs
Platform
Linux
Terminal Emulator
foot version: 1.17.2 +pgo +ime +graphemes -assertions
Installation Method
arch repo with paru
Helix Version
helix 25.1
The text was updated successfully, but these errors were encountered: