From 4476eb894615d07797c8db46025f611bb50cefd4 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 9 Jun 2022 18:27:09 -0700 Subject: [PATCH] bugfix: cut (C-x) without first selecting anything --- manual_tests | 3 +++ select.lua | 2 ++ 2 files changed, 5 insertions(+) diff --git a/manual_tests b/manual_tests index db2c579..8ca2893 100644 --- a/manual_tests +++ b/manual_tests @@ -36,6 +36,9 @@ persistence: draw a line, circle, rectangle, square, polygon, quit, restart. All the shapes you drew should still be visible. select a point and name it, quit, restart. Name is still visible. +clipboard: + cut/copy without making a selection + resize: create a file containing a long line of characters without spaces. try resizing the window vertically and horizontally, as far as possible. diff --git a/select.lua b/select.lua index 1121085..db875e3 100644 --- a/select.lua +++ b/select.lua @@ -103,12 +103,14 @@ function Text.to_pos(x,y) end function Text.cut_selection() + if Selection1.line == nil then return end local result = Text.selection() Text.delete_selection() return result end function Text.delete_selection() + if Selection1.line == nil then return end local minl,maxl = minmax(Selection1.line, Cursor1.line) local before = snapshot(minl, maxl) Text.delete_selection_without_undo()