Skip to content

Commit 68d6f43

Browse files
committed
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.
1 parent 6f724bc commit 68d6f43

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

internal/action/actions.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ func (h *BufPane) CutLine() bool {
12431243
return false
12441244
}
12451245
totalLines := nlines
1246-
if h.freshClip && time.Since(h.lastCutTime) < 10*time.Second {
1246+
if h.freshClip {
12471247
if clip, err := clipboard.Read(clipboard.ClipboardReg); err != nil {
12481248
InfoBar.Error(err)
12491249
return false
@@ -1255,7 +1255,6 @@ func (h *BufPane) CutLine() bool {
12551255
h.Cursor.CopySelection(clipboard.ClipboardReg)
12561256
}
12571257
h.freshClip = true
1258-
h.lastCutTime = time.Now()
12591258
h.Cursor.DeleteSelection()
12601259
h.Cursor.ResetSelection()
12611260
h.Cursor.StoreVisualX()

internal/action/bufpane.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,6 @@ type BufPane struct {
231231
lastClickTime time.Time
232232
lastLoc buffer.Loc
233233

234-
// lastCutTime stores when the last ctrl+k was issued.
235-
// It is used for clearing the clipboard to replace it with fresh cut lines.
236-
lastCutTime time.Time
237-
238234
// freshClip returns true if one or more lines have been cut to the clipboard
239235
// and have never been pasted yet.
240236
freshClip bool

0 commit comments

Comments
 (0)