fix(utils): handle case when indentation is wrong
This commit is contained in:
parent
360a5c254c
commit
1bb4931343
1 changed files with 4 additions and 1 deletions
|
|
@ -38,12 +38,15 @@ function utils.trimend(s)
|
|||
return r
|
||||
end
|
||||
|
||||
-- Since indentation can be spaces or tab, that's my hack around it
|
||||
-- Since indentation can be spaces or tabs, that's my hack around it
|
||||
---@param line string
|
||||
---@param indent integer
|
||||
---@return string
|
||||
function utils.indent(line, indent)
|
||||
local char = string.sub(line, 1, 1)
|
||||
if char ~= " " and char ~= "\t" then
|
||||
char = " "
|
||||
end
|
||||
return string.rep(char, indent)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue