Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly set the attrs field of the Style struct to be an int64 #348

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion get.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions set.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion style.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading