zed/crates/vim/test_data/test_matching_comments.json
Juan Pablo Briones 0bcf71f786
vim: Add C preprocessor check in matching function (#55515)
Closes #24820

This PR fixes the bug specified in issue
https://github.com/zed-industries/zed/issues/24820, now the matching
function checks if the cursor is above a comment or a directive before
defaulting to a bracket range as neovim does.

It also fixes fixes the `line_end` calculations so that when `%` is
pressed inside a bracket range


https://github.com/user-attachments/assets/f59daa6f-9769-45e8-bb8c-2d533470b59d

Release Notes:

- `fn matching()` checks for `preprocessor directives` or `comments`
before defaulting to any bracket range.
- In `fn matching()`line_end calculations avoid expanding a blank
current line into start..EOF.
2026-05-07 04:25:42 +00:00

13 lines
468 B
JSON

{"Put":{"state":"ˇ/*\n this is a comment\n*/"}}
{"Key":"%"}
{"Get":{"state":"/*\n this is a comment\nˇ*/","mode":"Normal"}}
{"Key":"%"}
{"Get":{"state":"ˇ/*\n this is a comment\n*/","mode":"Normal"}}
{"Key":"%"}
{"Get":{"state":"/*\n this is a comment\nˇ*/","mode":"Normal"}}
{"Key":"k"}
{"Key":"%"}
{"Get":{"state":"/*\nˇ this is a comment\n*/","mode":"Normal"}}
{"Put":{"state":"ˇ// comment"}}
{"Key":"%"}
{"Get":{"state":"ˇ// comment","mode":"Normal"}}