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.
|
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"