1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

notify user upon copying something to clipboard

This commit is contained in:
Jesse Duffield
2020-11-21 17:15:43 +11:00
parent a3dfcd5a95
commit 3e13936e08
7 changed files with 28 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package gui
import (
"fmt"
"math"
"strings"
@ -191,5 +192,13 @@ func (gui *Gui) handleCopySelectedSideContextItemToClipboard() error {
return nil
}
return gui.OSCommand.CopyToClipboard(itemId)
if err := gui.OSCommand.CopyToClipboard(itemId); err != nil {
return gui.surfaceError(err)
}
truncatedItemId := utils.TruncateWithEllipsis(strings.ReplaceAll(itemId, "\n", " "), 50)
gui.raiseToast(fmt.Sprintf("'%s' %s", truncatedItemId, gui.Tr.LcCopiedToClipboard))
return nil
}