From 8bc67569f96c2503260100ce4d10bc1169e89dbe Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Sun, 9 Jun 2024 01:46:46 +0200 Subject: [PATCH] Fix CopyLine at the last empty line of buffer When the cursor is at the last line of buffer and it is an empty line, CopyLine does not copy this line, which is correct, but it shows a bogus "Copied line" message. Fix this by adding a check for that, same as in CutLine and DeleteLine. --- internal/action/actions.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/action/actions.go b/internal/action/actions.go index 7b367011..5cb177ea 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -1181,6 +1181,9 @@ func (h *BufPane) CopyLine() bool { origLoc := h.Cursor.Loc origLastVisualX := h.Cursor.LastVisualX h.Cursor.SelectLine() + if !h.Cursor.HasSelection() { + return false + } h.Cursor.CopySelection(clipboard.ClipboardReg) h.freshClip = true InfoBar.Message("Copied line")