From c3a051dcca79a584dbf7a430fe27b7bc69474bf1 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 16 Oct 2026 07:53:03 +0200 Subject: [PATCH] Use Sprint for text that isn't a format string Two places pass plain text as the format string of TextStyle.Sprintf without further arguments: the prefix of a disabled menu item's tooltip, and the key binding entries of the options bar. If the text contains a "%", for example in a translation or in a key label, it is mangled into something like "%!(NOVERB)". go vet doesn't report these calls yet. It will once go.mod says go 1.26, because vet then also finds printf wrappers through interface methods. TextStyle.Sprintf forwards to the Sprintf method of the Sprinter interface. Co-Authored-By: Claude Opus 5.5 (1M context) --- pkg/gui/controllers/helpers/confirmation_helper.go | 2 +- pkg/gui/options_map.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/gui/controllers/helpers/confirmation_helper.go b/pkg/gui/controllers/helpers/confirmation_helper.go index 6bfd7ca4e..68d68575e 100644 --- a/pkg/gui/controllers/helpers/confirmation_helper.go +++ b/pkg/gui/controllers/helpers/confirmation_helper.go @@ -505,7 +505,7 @@ func (self *ConfirmationHelper) TooltipForMenuItem(menuItem *types.MenuItem) str if tooltip != "" { tooltip += "\n\n" } - tooltip += style.FgRed.Sprintf(self.c.Tr.DisabledMenuItemPrefix) + menuItem.DisabledReason.Text + tooltip += style.FgRed.Sprint(self.c.Tr.DisabledMenuItemPrefix) + menuItem.DisabledReason.Text } return tooltip } diff --git a/pkg/gui/options_map.go b/pkg/gui/options_map.go index 880a766b8..80b2b7a4f 100644 --- a/pkg/gui/options_map.go +++ b/pkg/gui/options_map.go @@ -127,7 +127,7 @@ func (self *OptionsMapMgr) formatBindingInfos(bindingInfos []bindingInfo) string break } - formatted := info.style.Sprintf(plainText) + formatted := info.style.Sprint(plainText) if i > 0 { builder.WriteString(theme.OptionsFgColor.Sprint(separator))