1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-23 12:18:51 +02:00

Fix tag being truncated when copying to clipboard (#4232)

Copy the whole tag to clipboard instead of truncating to the value of
TruncateCopiedCommitHashesTo.

- **PR Description**
My PR for copying the tag to clipboard was recently merged (#4219).
While using LazyGit built from the latest master I noticed that some
tags were being truncated, turns out it was due to a bug I introduced on
that previous PR.
Sorry for that.
This commit is contained in:
Stefan Haller 2025-02-04 08:57:22 +01:00 committed by GitHub
commit c0141685fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -148,7 +148,7 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
{
ViewName: "tags",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard,
Handler: self.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: self.c.Tr.CopyTagToClipboard,
},

View File

@ -15,7 +15,7 @@ var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.CreateLightweightTag("tag1", "HEAD")
shell.CreateLightweightTag("super.l000ongtag", "HEAD")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Tags().
@ -25,7 +25,7 @@ var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
).
Press(keys.Universal.CopyToClipboard)
t.ExpectToast(Equals("'tag1' copied to clipboard"))
t.ExpectToast(Equals("'super.l000ongtag' copied to clipboard"))
t.Views().Files().
Focus().
@ -34,6 +34,6 @@ var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
Contains("clipboard").IsSelected(),
)
t.Views().Main().Content(Contains("_tag1_"))
t.Views().Main().Content(Contains("super.l000ongtag"))
},
})