about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--select.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/select.lua b/select.lua
index 3d8999e..57791d5 100644
--- a/select.lua
+++ b/select.lua
@@ -163,14 +163,14 @@ function Text.selection()
     return Lines[minl].data:sub(min_offset, max_offset-1)
   end
   assert(minl < maxl)
-  local result = Lines[minl].data:sub(min_offset)..'\n'
+  local result = {Lines[minl].data:sub(min_offset)}
   for i=minl+1,maxl-1 do
     if Lines[i].mode == 'text' then
-      result = result..Lines[i].data..'\n'
+      table.insert(result, Lines[i].data)
     end
   end
-  result = result..Lines[maxl].data:sub(1, max_offset-1)
-  return result
+  table.insert(result, Lines[maxl].data:sub(1, max_offset-1))
+  return table.concat(result, '\n')
 end
 
 function Text.cut_selection()