Merge pull request #1060 from Guldoman/PR_drag_whitespace_newline

On `doc:newline` remove line content if it contains only whitespace
This commit is contained in:
Jefferson González 2022-07-05 17:56:13 -04:00 committed by GitHub
commit 58336f6060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -233,6 +233,10 @@ local commands = {
if col <= #indent then if col <= #indent then
indent = indent:sub(#indent + 2 - col) indent = indent:sub(#indent + 2 - col)
end 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) doc():text_input("\n" .. indent, idx)
end end
end, end,
@ -475,7 +479,7 @@ local commands = {
command.perform("doc:save-as") command.perform("doc:save-as")
end end
end, end,
["doc:reload"] = function() ["doc:reload"] = function()
doc():reload() doc():reload()
end, end,