Closed souserge closed 1 year ago
A bit of a longshot but the problem maybe fixed by #5711 if your file contains any non-ascii chars. Could you try again with that PR? Otherwise please post your file with which you experienced the crash so we can reproduce and test the problem ourselfs.
https://github.com/helix-editor/helix/issues/1410 has the same panic, it seems to have to do with paste and then undo
1410 has the same panic, it seems to have to do with paste and then undo
Any kind of incorrect transaction applied to a document can cause crashes like these. A ton of different bugs can cause incorrect transactions to be produced so the panic message doesn't tell us much about the cause. Since #1410 was reported most of these issues have been fixed (many by @the-mikedavis). So this is likely a different bug. It sounds like it's LSP related hence I suggested #5711 since I had similar crashes while testing that (before I finally fixed them all)
I can't reproduce this with just those steps: can you reliably reproduce this with some exact clipboard contents? If you can reproduce could you capture the full backtrace by setting RUST_BACKTRACE=1
?
Also: do you have a language server installed for javascript and have you configured it to format on save?
Also: do you have a language server installed for javascript and have you configured it to format on save?
I think he does, from the issue description:
Additionally, I have the JavaScript language server running, and auto-format using prettier.
Which reminded me of #4791 (hence my guess that #5711 may fix this)
I had a similar crash lately, it happened when I was pasting via middle click (and I might have been in insert mode?) then undo. It was a Go file in my case
@pascalkuthe @the-mikedavis I'm not sure if I reproduced the same bug I had last time, since now the panic output looks different. Nevertheless, the circumstances are very similar so it's probably caused by the same issue.
config.toml --> [editor] --> mouse
property.testHelixBug.txt
. Since I was able to replicate it without saving, I think auto-format here is not involved.typescript-language-server@3.0.3
varlad/helix
)hx --heath
)[editor] --> mouse
NOT set to false
(I also recorded it using asciinema).
testHelixbug.js
) with the following contents:
// Make sure the mouse isn't disabled (editor.mouse in config.toml)
// Steps to reproduce:
// * Click on the last line (marked with tilde)
// * Press: <middle-click> <middle-click> <middle-click> u <middle-click> u
function test() { return "Hello, world!"; }
2. Copy the following text to your system clipboard: `helix editor`
3. Open the file: `$ RUST_BACKTRACE=full hx testHelixBug.js`
4. Click somewhere on the last line (should be marked with a tilda) with a mouse. You don't need to actually click it as long as you have the cursor there.
5. Press: `<middle-click> <middle-click> <middle-click> u <middle-click> u`
6. Observe the crash (`Position` and `len` might differ):
<pre>
thread 'main' panicked at 'Position 307 is out of range for changeset len 302!', helix-core/src/transaction.rs:397:13
stack backtrace:
0: 0x558872968465 - <unknown>
1: 0x5588720489ae - <unknown>
2: 0x558872962105 - <unknown>
3: 0x558872969de3 - <unknown>
4: 0x558872969aef - <unknown>
5: 0x55887296a4af - <unknown>
6: 0x55887296a314 - <unknown>
7: 0x55887296896c - <unknown>
8: 0x55887296a062 - <unknown>
9: 0x558871fb5e43 - <unknown>
10: 0x558872158572 - <unknown>
11: 0x558872712a8f - <unknown>
12: 0x558872714034 - <unknown>
13: 0x558872608159 - <unknown>
14: 0x55887248e646 - <unknown>
15: 0x55887248e56e - <unknown>
16: 0x558872490e5b - <unknown>
17: 0x5588725c7845 - <unknown>
18: 0x5588727afcc7 - <unknown>
19: 0x5588727d058f - <unknown>
20: 0x558872809a79 - <unknown>
21: 0x55887282aa70 - <unknown>
22: 0x5588727d1301 - <unknown>
23: 0x5588728110f3 - <unknown>
24: 0x5588728215f9 - <unknown>
25: 0x55887295d6ba - <unknown>
26: 0x5588727d1408 - <unknown>
27: 0x7f5558d05510 - __libc_start_call_main
28: 0x7f5558d055c9 - __libc_start_main@GLIBC_2.2.5
29: 0x558871ff21d5 - <unknown>
30: 0x0 - <unknown>
</pre>
Thank you so much for following up on this! I can reproduce this easily on the latest master and am looking into a fix. Detail reproduction cases like this are greatly appreciated. Not LSP related tough as this also occurs with :language text
turns out all paste commands don't append to history when called as a typable commands (which is a well known cause of crashes in combination with undo). Middle mouse just call :clipboard-paste-before
, the same crash can also be reproduced by just using the typable command directly. #5790 fixes the problem
I have managed to get a panic very similar to this issue.
thread 'main' panicked at D:\a\helix\helix\helix-core\src\transaction.rs:461:9:
Positions [(8682, After)] are out of range for changeset len 8674!
note: run with `RUST...
Happened on an undo after a clipboard-paste-replace
. I didn't open a new issue because I don't have reproduction steps.
Summary
I had an opened JS file in helix. I accidentally pasted some text from the system clipboard several times by making a three-finger gesture swiping from right to left (the pasting action is probably due to me using tmux). I pressed 'u' to undo it and it said "Already at oldest change". After pressing Escape, I could undo the change but after pressing it a few times, Helix crashed with the error message presented in the Helix log. I may have tried writing the file with :w (don't remember exactly).
Additionally, I have the JavaScript language server running, and auto-format using prettier.
Reproduction Steps
I tried this: 1. `tmux` 2. `hx file.js` 3. paste something form the system's clipboard. 4. press `u` 5. press `