MCPcopy
hub / github.com/jesseduffield/lazygit / StringWidth

Function StringWidth

pkg/utils/formatting.go:25–35  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

23}
24
25func StringWidth(s string) int {
26 // We are intentionally not using a range loop here, because that would
27 // convert the characters to runes, which is unnecessary work in this case.
28 for i := range len(s) {
29 if s[i] > unicode.MaxASCII {
30 return uniseg.StringWidth(s)
31 }
32 }
33
34 return len(s)
35}
36
37// WithPadding pads a string as much as you want
38func WithPadding(str string, padding int, alignment Alignment) string {

Callers 11

handleInfoClickMethod · 0.92
formatBindingInfosMethod · 0.92
infoSectionChildrenFunction · 0.92
renderAppStatusMethod · 0.92
getBranchDisplayStringsFunction · 0.92
validateSpinnerFunction · 0.92
WithPaddingFunction · 0.85
getPadWidthsFunction · 0.85
TruncateWithEllipsisFunction · 0.85

Calls

no outgoing calls