aboutsummaryrefslogtreecommitdiff
path: root/plugins/linecopypaste.lua
diff options
context:
space:
mode:
authorcukmekerb <cukmekerb@gmail.com>2021-09-11 13:44:38 -0700
committercukmekerb <cukmekerb@gmail.com>2021-09-11 13:44:38 -0700
commit37607f12c9165627de0253fdb4db07d2ffac56d6 (patch)
tree67231236ade80f36dfb99f8f31dff57b8de2d478 /plugins/linecopypaste.lua
parent132e67f214d20840e207da5703789f2f57c4845f (diff)
parenteca7bfe9d7e20acfb49902c9fced85f0a5a978cc (diff)
downloadlite-xl-plugins-37607f12c9165627de0253fdb4db07d2ffac56d6.tar.gz
lite-xl-plugins-37607f12c9165627de0253fdb4db07d2ffac56d6.zip
Merge branch 'master' of https://github.com/lite-xl/lite-plugins
Diffstat (limited to 'plugins/linecopypaste.lua')
-rw-r--r--[-rwxr-xr-x]plugins/linecopypaste.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/linecopypaste.lua b/plugins/linecopypaste.lua
index d332cc1..ea2a84c 100755..100644
--- a/plugins/linecopypaste.lua
+++ b/plugins/linecopypaste.lua
@@ -28,7 +28,11 @@ command.map["doc:cut"].perform = function()
else
local line = doc():get_selection()
system.set_clipboard(doc().lines[line])
- doc():remove(line, 1, line+1, 1)
+ if line < #(doc().lines) then
+ doc():remove(line, 1, line+1, 1)
+ else -- last line in file
+ doc():remove(line, 1, line, #(doc().lines[line]))
+ end
doc():set_selection(line, 1)
line_in_clipboard = true
end