From 3a6e098fc974e409a606257b7b75212417bbdf99 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Sun, 29 Aug 2021 23:12:09 +0200 Subject: `linecopypaste`: Fix cutting last line --- plugins/linecopypaste.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) mode change 100755 => 100644 plugins/linecopypaste.lua (limited to 'plugins/linecopypaste.lua') diff --git a/plugins/linecopypaste.lua b/plugins/linecopypaste.lua old mode 100755 new mode 100644 index d332cc1..ea2a84c --- 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 -- cgit v1.2.3