From 4856c96521170fd5356aa3ad0c9d6db6babeb06e Mon Sep 17 00:00:00 2001 From: Bruno Jesus Date: Mon, 3 Feb 2025 21:25:34 +0000 Subject: [PATCH] Fix tag truncated when copying to clipboard Copy the whole tag to clipboard instead of truncating to the value of TruncateCopiedCommitHashesTo. --- pkg/gui/keybindings.go | 2 +- pkg/integration/tests/tag/copy_to_clipboard.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 72af2f9fd..300d8440e 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -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, }, diff --git a/pkg/integration/tests/tag/copy_to_clipboard.go b/pkg/integration/tests/tag/copy_to_clipboard.go index f0176df9a..124c94f94 100644 --- a/pkg/integration/tests/tag/copy_to_clipboard.go +++ b/pkg/integration/tests/tag/copy_to_clipboard.go @@ -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")) }, })