diff options
author | rxi <rxi@users.noreply.github.com> | 2020-05-06 20:13:58 +0100 |
---|---|---|
committer | rxi <rxi@users.noreply.github.com> | 2020-05-06 20:13:58 +0100 |
commit | 985747d1e31ff14f1066b40ab079a45f239e6117 (patch) | |
tree | bf8fa3ad92ff706cb3c2627a7b25b267b57eaad5 | |
parent | 9f21c411a3ddc5afddcf3dd05b85f6cc92a48858 (diff) | |
download | lite-xl-plugins-985747d1e31ff14f1066b40ab079a45f239e6117.tar.gz lite-xl-plugins-985747d1e31ff14f1066b40ab079a45f239e6117.zip |
lfautoinsert plugin improvements
-rw-r--r-- | plugins/lfautoinsert.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/lfautoinsert.lua b/plugins/lfautoinsert.lua index 64006b9..4104cb4 100644 --- a/plugins/lfautoinsert.lua +++ b/plugins/lfautoinsert.lua @@ -28,16 +28,16 @@ end command.add("core.docview", { ["autoinsert:newline"] = function() - command.perform("doc:newline") - local doc = core.active_view.doc local line = doc:get_selection() - local text = doc.lines[line - 1] + local text = doc.lines[line] + + command.perform("doc:newline") for ptn, close in pairs(config.autoinsert_map) do if text:find(ptn) then if close - and indent_size(doc, line + 1) <= indent_size(doc, line - 1) + and indent_size(doc, line + 2) <= indent_size(doc, line) then command.perform("doc:newline") core.active_view:on_text_input(close) |