From c792b136667b1181b7f3185ceef6bc056501bf18 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Sat, 25 Jun 2022 03:57:47 +0200 Subject: [PATCH] On `doc:newline` remove line content if it contains only whitespace --- data/core/commands/doc.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data/core/commands/doc.lua b/data/core/commands/doc.lua index 116d48de..5b0ef6e7 100644 --- a/data/core/commands/doc.lua +++ b/data/core/commands/doc.lua @@ -233,6 +233,10 @@ local commands = { if col <= #indent then indent = indent:sub(#indent + 2 - col) end + -- Remove current line if it contains only whitespace + if doc().lines[line]:match("^%s+$") then + doc():remove(line, 1, line, math.huge) + end doc():text_input("\n" .. indent, idx) end end, @@ -475,7 +479,7 @@ local commands = { command.perform("doc:save-as") end end, - + ["doc:reload"] = function() doc():reload() end,