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

Neovim crashes when editing multilevel list #114

Closed
fisher-j opened this issue Aug 24, 2023 · 4 comments · Fixed by #115
Closed

Neovim crashes when editing multilevel list #114

fisher-j opened this issue Aug 24, 2023 · 4 comments · Fixed by #115
Labels
bug Something isn't working

Comments

@fisher-j
Copy link

fisher-j commented Aug 24, 2023

Describe the bug

When editing a multilevel list, and starting a new "de-dented" list item neovim crashes without warning. Often this only happens after typing and deleting a character (with backspace) on the new item.

For instance, if I open a test.md with the following contents:

# A list

- item 1
  - sub-item
    - level three
  -

and then place my cursor on the last line, and type a space followed by some characters, and then possibly a backspace, neovim crashes.

The behavior is reproducible, but not perfectly so. To reproduce I might have to do any of the following (on the last line, after the list marker):

  • type a single character
  • type several characters
  • type several characters followed by a backspace
  • repeatedly type 1 or more chacters followed by an equal number of backspaces

I was able to reproduce this behavior when treesitter is the only plugin I load.

Once I was able to reopen the file and observe an error which I think mentioned an out of range index for extmark, but unfortunately, I have not be able to reproduce the error message.

@fisher-j fisher-j added the bug Something isn't working label Aug 24, 2023
@difeiyu
Copy link

difeiyu commented Aug 26, 2023

I also encountered this problem, the same way to reproduce

## HOME
- a
    - aa
        - aaa
    - ac

vim crashes when backspace is pressed
I removed all plugins except treesitter, same goes for tests

@ibash
Copy link
Contributor

ibash commented Sep 15, 2023

Maybe related: neovim/neovim#25164

ibash added a commit to ibash/tree-sitter-markdown that referenced this issue Sep 16, 2023
Previously deserializing assumed that open_blocks had enough capacity to
deserialize all blocks. It appears that this is not always the case and
that open blocks can overflow.

This commit will realloc s->open_blocks if the current capacity is not
big enough.

Fixes tree-sitter-grammars#114
Fixes neovim/neovim#25164
@ibash
Copy link
Contributor

ibash commented Sep 16, 2023

For posterity, you can apply the patch as per instructions here: neovim/neovim#25164 (comment)

@zmre
Copy link

zmre commented Sep 23, 2023

This bug has been killing me. Stack traces were misleading. Random quits when editing notes. Have temporarily disabled treesitter markdown but am hoping the linked PR gets accepted and a new release made. I see the workaround that uses ibash's fork, and I can make that work if necessary (though differently since I use nix), but would far rather see it fixed here. I know maintaining open source software like this can be thankless, so just want to send out a thank you to whomever (@MDeiml ?) is able to review and help get the bug fix through to a release. Thank you and thanks to @ibash for tracking it down!

zmre added a commit to zmre/pwnvim that referenced this issue Nov 13, 2023
The bug tree-sitter-grammars/tree-sitter-markdown#114 was
finally fixed, merged and a release cut. But nix is being slow to update
grammars as usual. So we're overlaying the new release now. W00t!

Also updating this go:

ruff: 0.1.4 → 0.1.5, +61.9 KiB
vscode-langservers-custom: 4.7.0 → 4.8.0, +1305.9 KiB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants