diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-03-17 20:43:32 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-03-22 09:58:54 +0100 |
commit | 3b29705a7876c13f47a6478e17ad7ee4fc78ff8c (patch) | |
tree | 36f75deac15124b7b4c6fb0279aa2208a624fcb5 /pkg/gui/keybindings.go | |
parent | 28dd7f946752d31487b207ab05338dbf4898042f (diff) |
Add config to truncate commit hashes when copying them to the clipboard
I often copy hashes in the commits panel in order to paste them into Github
comments (or other places), and I can't stand it when they have the full length.
I picked a default of 12 for this; I find this to be a good middle ground
between being reliable in large repos (12 still works in the linux kernel repo
today, but it might not be enough in really huge repos) and not being too ugly
(many smaller repos can probably get away with less).
We deliberately don't change this for the "Copy to clipboard" menu, since this
gives users a way to copy the unabbreviated sha if they need this occasionally.
Diffstat (limited to 'pkg/gui/keybindings.go')
-rw-r--r-- | pkg/gui/keybindings.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 6275d5189..02405b9b6 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -146,7 +146,7 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi { ViewName: "commits", Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), - Handler: self.handleCopySelectedSideContextItemToClipboard, + Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard, GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason, Description: self.c.Tr.CopyCommitShaToClipboard, }, @@ -166,7 +166,7 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi { ViewName: "subCommits", Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), - Handler: self.handleCopySelectedSideContextItemToClipboard, + Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard, GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason, Description: self.c.Tr.CopyCommitShaToClipboard, }, |