Sfoglia il codice sorgente

style: run golangci-lint run --fix

ayn2op 1 mese fa
parent
commit
082c018f53

+ 1 - 1
internal/cache/cache.go

@@ -31,7 +31,7 @@ func (c *Cache) Get(query string) uint {
 // the search limit.
 // "aa", "ab", "ac", ..., "ay" // where length is longer than the limit
 // if "ay" leaves, then "az" would not be loaded becaue it would not be
-// returned by the search results because of the search limit
+// returned by the search results because of the search limit.
 func (c *Cache) Invalidate(name string, limit uint) {
 	for name != "" {
 		if c.Exists(name) && c.Get(name) >= limit {

+ 7 - 12
internal/config/theme.go

@@ -31,10 +31,6 @@ func (aw *AlignmentWrapper) UnmarshalTOML(v any) error {
 
 type StyleWrapper struct{ tcell.Style }
 
-func NewStyleWrapper(style tcell.Style) StyleWrapper {
-	return StyleWrapper{Style: style}
-}
-
 func (sw *StyleWrapper) UnmarshalTOML(v any) error {
 	m, ok := v.(map[string]any)
 	if !ok {
@@ -64,7 +60,6 @@ func (sw *StyleWrapper) UnmarshalTOML(v any) error {
 						sw.parseAttr(s)
 					}
 				}
-
 			}
 		case "underline":
 			if s, ok := val.(string); ok {
@@ -176,14 +171,14 @@ func (vw *ScrollBarVisibilityWrapper) UnmarshalTOML(val any) error {
 	return nil
 }
 
-type HelpTheme struct {
-	ShortKeyStyle  StyleWrapper `toml:"short_key_style"`
-	ShortDescStyle StyleWrapper `toml:"short_desc_style"`
-	FullKeyStyle   StyleWrapper `toml:"full_key_style"`
-	FullDescStyle  StyleWrapper `toml:"full_desc_style"`
-}
-
 type (
+	HelpTheme struct {
+		ShortKeyStyle  StyleWrapper `toml:"short_key_style"`
+		ShortDescStyle StyleWrapper `toml:"short_desc_style"`
+		FullKeyStyle   StyleWrapper `toml:"full_key_style"`
+		FullDescStyle  StyleWrapper `toml:"full_desc_style"`
+	}
+
 	ThemeStyle struct {
 		NormalStyle StyleWrapper `toml:"normal_style"`
 		ActiveStyle StyleWrapper `toml:"active_style"`

+ 1 - 1
internal/ui/chat/mentions_list.go

@@ -39,7 +39,7 @@ func (m *mentionsList) append(item mentionsListItem) {
 
 func (m *mentionsList) clear() {
 	m.items = nil
-	m.List.Clear()
+	m.Clear()
 }
 
 func (m *mentionsList) rebuild() {

+ 1 - 2
internal/ui/chat/message_input.go

@@ -496,7 +496,7 @@ func (ul userList) Len() int {
 	return len(ul)
 }
 
-// channelHasUser checks if a user has permission to view the specified channel
+// channelHasUser checks if a user has permission to view the specified channel.
 func channelHasUser(state *ningen.State, channelID discord.ChannelID, userID discord.UserID) bool {
 	perms, err := state.Permissions(channelID, userID)
 	if err != nil {
@@ -622,7 +622,6 @@ func (mi *messageInput) addMentionUser(user *discord.User) {
 	})
 }
 
-// used by chatView
 func (mi *messageInput) removeMentionsList() {
 	mi.chatView.HideLayer(mentionsListLayerName)
 }

+ 1 - 1
internal/ui/chat/messages_list.go

@@ -774,7 +774,7 @@ func unescapeMarkdownEscapes(s string) string {
 	var b strings.Builder
 	b.Grow(len(s))
 
-	for i := 0; i < len(s); i++ {
+	for i := range len(s) {
 		if s[i] == '\\' && i+1 < len(s) && isMarkdownEscapable(s[i+1]) {
 			continue
 		}

+ 1 - 1
internal/ui/chat/view.go

@@ -418,7 +418,7 @@ func (v *View) updateFooter() {
 
 		switch len(names) {
 		case 1:
-			footer = fmt.Sprintf("%s is typing...", names[0])
+			footer = names[0] + " is typing..."
 		case 2:
 			footer = fmt.Sprintf("%s and %s are typing...", names[0], names[1])
 		case 3: