mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-06 13:00:59 -04:00
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) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9bb7ac77b2
commit
c3a051dcca
@@ -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
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user