diff options
author | Guldoman <giulio.lettieri@gmail.com> | 2022-07-11 06:03:58 +0200 |
---|---|---|
committer | Guldoman <giulio.lettieri@gmail.com> | 2022-07-11 06:04:12 +0200 |
commit | 1ea1994c232d5fae868c7468ed44fed71baa5709 (patch) | |
tree | e67eb5e28a6223d32c60a4024286acaf07c9bd5f | |
parent | a2803e8ba7ebc08e0fe5abf45058af0b02723784 (diff) | |
download | lite-xl-plugins-1ea1994c232d5fae868c7468ed44fed71baa5709.tar.gz lite-xl-plugins-1ea1994c232d5fae868c7468ed44fed71baa5709.zip |
`autoinsert`: avoid deleting wrong characters
-rw-r--r-- | plugins/autoinsert.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua index 638d6cc..d9bf291 100644 --- a/plugins/autoinsert.lua +++ b/plugins/autoinsert.lua @@ -89,8 +89,12 @@ command.add(predicate, { local doc = core.active_view.doc local l, c = doc:get_selection() local chr = doc:get_char(l, c) - if config.plugins.autoinsert.map[doc:get_char(l, c - 1)] and is_closer(chr) then - doc:delete_to(1) + if c > 1 then + local chr = doc:get_char(l, c) + local mapped = config.plugins.autoinsert.map[doc:get_char(l, c - 1)] + if mapped and mapped == chr then + doc:delete_to(1) + end end command.perform "doc:backspace" end, |