From 68d6f43c638673960057117efeb24b945afabf5a Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Wed, 12 Jun 2024 03:16:36 +0200 Subject: [PATCH] CutLine: remove lastCutTime feature The lastCutTime feature (reset the clipboard instead of appending to the clipboard if the last CutLine was more than 10 seconds ago) was implemented 8 years ago but was always buggy and never really worked, until we have accidentally found and fixed the bug just now. No one ever complained or noticed that, which means it is not a very useful feature. Fixing it changes the existing behavior (essentially adds a new feature which did not really exist before) and there is no reason to assume that this new behavior will be welcome by users. So it's better to remove this feature. --- internal/action/actions.go | 3 +-- internal/action/bufpane.go | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/internal/action/actions.go b/internal/action/actions.go index c3b4b150..cca43bfd 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -1243,7 +1243,7 @@ func (h *BufPane) CutLine() bool { return false } totalLines := nlines - if h.freshClip && time.Since(h.lastCutTime) < 10*time.Second { + if h.freshClip { if clip, err := clipboard.Read(clipboard.ClipboardReg); err != nil { InfoBar.Error(err) return false @@ -1255,7 +1255,6 @@ func (h *BufPane) CutLine() bool { h.Cursor.CopySelection(clipboard.ClipboardReg) } h.freshClip = true - h.lastCutTime = time.Now() h.Cursor.DeleteSelection() h.Cursor.ResetSelection() h.Cursor.StoreVisualX() diff --git a/internal/action/bufpane.go b/internal/action/bufpane.go index 4d17816e..4f213751 100644 --- a/internal/action/bufpane.go +++ b/internal/action/bufpane.go @@ -231,10 +231,6 @@ type BufPane struct { lastClickTime time.Time lastLoc buffer.Loc - // lastCutTime stores when the last ctrl+k was issued. - // It is used for clearing the clipboard to replace it with fresh cut lines. - lastCutTime time.Time - // freshClip returns true if one or more lines have been cut to the clipboard // and have never been pasted yet. freshClip bool