summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-12-13 14:19:58 +0100
committerWuzzy <almikes@aol.com>2016-12-13 14:19:58 +0100
commit6927db384b65476e884ed2cb6c42b51bb59daea8 (patch)
tree4896490ae8b44cfb95ff3c0bc2140d65db0fb423 /init.lua
parent664a758e749800c2268fc9167cafdc620c6867bf (diff)
Don't add newlines after empty lines
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index bea901a..37485ce 100644
--- a/init.lua
+++ b/init.lua
@@ -81,7 +81,7 @@ end
--[[ Append a newline to text, unless it already ends with a newline. ]]
local newline = function(text)
- if string.sub(text, #text, #text) == "\n" then
+ if string.sub(text, #text, #text) == "\n" or text == "" then
return text
else
return text .. "\n"
@@ -90,7 +90,7 @@ end
--[[ Make sure the text ends with two newlines by appending any missing newlines at the end, if neccessary. ]]
local newline2 = function(text)
- if string.sub(text, #text-1, #text) == "\n\n" then
+ if string.sub(text, #text-1, #text) == "\n\n" or text == "" then
return text
elseif string.sub(text, #text, #text) == "\n" then
return text .. "\n"