Customized fork of github.com/rxi/lite

Improved behaviour of `doc:join-lines` when joining to empty line

rxi de5cb4fa 878c94a3

Changed files
+3 -1
data
core
commands
+3 -1
data/core/commands/doc.lua
··· 160 160 local line1, _, line2 = doc():get_selection(true) 161 161 if line1 == line2 then line2 = line2 + 1 end 162 162 local text = doc():get_text(line1, 1, line2, math.huge) 163 - text = text:gsub("\n[\t ]*", " ") 163 + text = text:gsub("(.-)\n[\t ]*", function(x) 164 + return x:find("^%s*$") and x or x .. " " 165 + end) 164 166 doc():insert(line1, 1, text) 165 167 doc():remove(line1, #text + 1, line2, math.huge) 166 168 if doc():has_selection() then