Vertically align list item continuation lines when autowrapping

This commit is contained in:
Peter Melnichenko
2018-04-10 16:10:56 +03:00
parent 849622d8e2
commit b8c12f50e3
2 changed files with 35 additions and 1 deletions

View File

@@ -807,7 +807,13 @@ local function autowrap_line(line, max_length)
local result_lines = {}
-- Preserve original indentation of the line, put this at the beginning of each result line.
local indentation = line:match("^( *)")
-- If the first word looks like a list marker ('*', '+', or '-'), add spaces so that starts
-- of the second and the following lines vertically align with the start of the second word.
local indentation = line:match("^ *")
if line:find("^ *[%*%+%-]") then
indentation = indentation .. " " .. line:match("^ *[%*%+%-]( *)")
end
-- Parts of the last line being assembled.
local line_parts = {}