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.
This commit is contained in:
Dmytro Maluka
2024-06-12 03:16:36 +02:00
parent 6f724bc424
commit 68d6f43c63
2 changed files with 1 additions and 6 deletions

View File

@@ -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()

View File

@@ -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