vis icon indicating copy to clipboard operation
vis copied to clipboard

Unmatched parenthesis in singly-quoted string will desperately attempt to match with a regular parenthesis outside said string

Open samuelmarquis opened this issue 1 year ago • 3 comments

Problem

image image

Steps to reproduce

( '(' )) is balanced

vis version (vis -v)

vis v0.9-git +curses +lua +tre +acl +selinux

Terminal name/version

No response

$TERM environment variable

No response

samuelmarquis avatar Dec 23 '24 01:12 samuelmarquis

Note: only with single quotes, not double quotes.

Does this come down to "what does the lexer say is a string/comment(?)" or is there something internal that handles it?

samuelmarquis avatar Dec 23 '24 01:12 samuelmarquis

The problem is that drawing matching cursors is independent of the syntax and build into the editor core. You can verify this by using a plain text file without any syntax.

The function window_draw_cursor_matching (vis.c:292) responsibly for styling matching symbols, uses text_bracket_match_symbol (text-motions.c:572) internally, which naively searches for bytes in a certain direction.

Maybe the styling of matching symbols should be moved to lua if a syntax is available.

fischerling avatar Dec 25 '24 15:12 fischerling

Thanks for the pointer, I'll mess around with this and send a PR if I get it figured out. Do you guys prefer/prioritize PRs on the mailing list, or is here fine?

samuelmarquis avatar Dec 25 '24 15:12 samuelmarquis