aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco <francesco.bbt@gmail.com>2021-08-30 09:12:35 +0200
committerGitHub <noreply@github.com>2021-08-30 09:12:35 +0200
commitae60c3a8734b8b6f16d27afcb85b1f50de025698 (patch)
tree6a27a0addc642d5b3773cd7602a1bd3539fd367d
parent43f8837c52680e0e502c0a0d3f6f243e930f34af (diff)
parent3a6e098fc974e409a606257b7b75212417bbdf99 (diff)
downloadlite-xl-plugins-ae60c3a8734b8b6f16d27afcb85b1f50de025698.tar.gz
lite-xl-plugins-ae60c3a8734b8b6f16d27afcb85b1f50de025698.zip
Merge pull request #60 from Guldoman/linecopypaste_last_line
`linecopypaste`: Fix cutting last line
-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