mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-22 14:14:36 +00:00
fixed dedent() with trimmed blank lines (some editors do this automatically)
This commit is contained in:
parent
662101ddae
commit
7285531870
@ -192,6 +192,7 @@ function stringx.deindent(s, keep_trailing_empty)
|
||||
--de-indent the lines
|
||||
local res = {}
|
||||
for _, line in ipairs(lines) do
|
||||
if line ~= "" then
|
||||
local line_start = line:sub(1, indent:len())
|
||||
local start_len = line_start:len()
|
||||
if
|
||||
@ -203,6 +204,7 @@ function stringx.deindent(s, keep_trailing_empty)
|
||||
then
|
||||
line = line:sub(start_len + 1)
|
||||
end
|
||||
end
|
||||
table.insert(res, line)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user