+3
-1
data/core/commands/doc.lua
+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