-
-
Notifications
You must be signed in to change notification settings - Fork 137
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
In this code, it just map the last byte of the pair, when it comes to utf-8 pairs, such as "(" and ")", which are more than one byte. The mappings may be broken when there is no "keymap" or "keymap_end" set for the rule.
nvim-autopairs/lua/nvim-autopairs.lua
Lines 292 to 296 in 59bce2e
| if rule.key_map == '' then | |
| rule.key_map = rule.start_pair:sub(#rule.start_pair) | |
| end | |
| expr_map(rule.key_map) | |
| local key_end = rule.key_end or rule.end_pair:sub(1, 1) |
Maybe a more graceful way to do this is to map the last chracter rather than the last byte when keymap and keymap_end is not set by users.
Minimal config
Maybe the minimal repro is to add a rule for "(" and ")" but not set "key_map" and "key_map_end"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working