mirror of
https://github.com/zyedidia/micro.git
synced 2024-10-06 00:22:12 +03:00
CutLine: make infobar message more useful
Since CutLine may add lines to the clipboard instead of replacing the clipboard, improve its info message to show how many lines are in the clipboard in total, not just how many lines were added to it last time.
This commit is contained in:
parent
fdacb28962
commit
e6825f0e08
@ -1242,11 +1242,13 @@ func (h *BufPane) CutLine() bool {
|
||||
if nlines == 0 {
|
||||
return false
|
||||
}
|
||||
totalLines := nlines
|
||||
if h.freshClip && time.Since(h.lastCutTime) < 10*time.Second {
|
||||
if clip, err := clipboard.Read(clipboard.ClipboardReg); err != nil {
|
||||
InfoBar.Error(err)
|
||||
} else {
|
||||
clipboard.WriteMulti(clip+string(h.Cursor.GetSelection()), clipboard.ClipboardReg, h.Cursor.Num, h.Buf.NumCursors())
|
||||
totalLines = strings.Count(clip, "\n") + nlines
|
||||
}
|
||||
} else {
|
||||
h.Copy()
|
||||
@ -1256,8 +1258,8 @@ func (h *BufPane) CutLine() bool {
|
||||
h.Cursor.DeleteSelection()
|
||||
h.Cursor.ResetSelection()
|
||||
h.Cursor.StoreVisualX()
|
||||
if nlines > 1 {
|
||||
InfoBar.Message(fmt.Sprintf("Cut %d lines", nlines))
|
||||
if totalLines > 1 {
|
||||
InfoBar.Message(fmt.Sprintf("Cut %d lines", totalLines))
|
||||
} else {
|
||||
InfoBar.Message("Cut line")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user