From f7097a823e74d6c607f4be706910b6198084cdfb Mon Sep 17 00:00:00 2001 From: Mathias Gibbens Date: Sun, 18 Aug 2024 20:00:55 +0000 Subject: [PATCH] Explicitly set the attrs field of the Style struct to be an int64 This fixes test failures on 32bit systems where an int is only 32 bits long Signed-off-by: Mathias Gibbens --- get.go | 2 +- set.go | 12 ++++++------ style.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/get.go b/get.go index 9c2f06fe..c2a8f235 100644 --- a/get.go +++ b/get.go @@ -423,7 +423,7 @@ func (s Style) getAsBool(k propKey, defaultVal bool) bool { if !s.isSet(k) { return defaultVal } - return s.attrs&int(k) != 0 + return s.attrs&int64(k) != 0 } func (s Style) getAsColor(k propKey) TerminalColor { diff --git a/set.go b/set.go index ed6e272c..1d67516f 100644 --- a/set.go +++ b/set.go @@ -68,16 +68,16 @@ func (s *Style) set(key propKey, value interface{}) { default: if v, ok := value.(bool); ok { //nolint:nestif if v { - s.attrs |= int(key) + s.attrs |= int64(key) } else { - s.attrs &^= int(key) + s.attrs &^= int64(key) } - } else if attrs, ok := value.(int); ok { + } else if attrs, ok := value.(int64); ok { // bool attrs - if attrs&int(key) != 0 { - s.attrs |= int(key) + if attrs&int64(key) != 0 { + s.attrs |= int64(key) } else { - s.attrs &^= int(key) + s.attrs &^= int64(key) } } } diff --git a/style.go b/style.go index 4343d3cd..0d3b42e0 100644 --- a/style.go +++ b/style.go @@ -119,7 +119,7 @@ type Style struct { value string // we store bool props values here - attrs int + attrs int64 // props that have values fgColor TerminalColor