mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Clean up a bunch of if statements based on govet results
This commit is contained in:
@@ -425,9 +425,9 @@ func ASCIItoTviewColors(text string) string {
|
||||
func colorFor(label string) tcell.Color {
|
||||
if _, ok := colors[label]; ok {
|
||||
return colors[label]
|
||||
} else {
|
||||
return tcell.ColorGreen
|
||||
}
|
||||
|
||||
return tcell.ColorGreen
|
||||
}
|
||||
|
||||
func replaceWithHexColorString(substring string) string {
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
type FocusState int
|
||||
|
||||
const (
|
||||
Widget FocusState = iota
|
||||
AppBoard
|
||||
NeverFocused
|
||||
widgetFocused FocusState = iota
|
||||
appBoardFocused
|
||||
neverFocused
|
||||
)
|
||||
|
||||
// FocusTracker is used by the app to track which onscreen widget currently has focus,
|
||||
@@ -42,7 +42,7 @@ func (tracker *FocusTracker) FocusOn(char string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if tracker.focusState() == AppBoard {
|
||||
if tracker.focusState() == appBoardFocused {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ func (tracker *FocusTracker) FocusOn(char string) bool {
|
||||
// Next sets the focus on the next widget in the widget list. If the current widget is
|
||||
// the last widget, sets focus on the first widget.
|
||||
func (tracker *FocusTracker) Next() {
|
||||
if tracker.focusState() == AppBoard {
|
||||
if tracker.focusState() == appBoardFocused {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ func (tracker *FocusTracker) Next() {
|
||||
|
||||
// None removes focus from the currently-focused widget.
|
||||
func (tracker *FocusTracker) None() {
|
||||
if tracker.focusState() == AppBoard {
|
||||
if tracker.focusState() == appBoardFocused {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ func (tracker *FocusTracker) None() {
|
||||
// Prev sets the focus on the previous widget in the widget list. If the current widget is
|
||||
// the last widget, sets focus on the last widget.
|
||||
func (tracker *FocusTracker) Prev() {
|
||||
if tracker.focusState() == AppBoard {
|
||||
if tracker.focusState() == appBoardFocused {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -156,16 +156,16 @@ func (tracker *FocusTracker) focusableAt(idx int) Wtfable {
|
||||
|
||||
func (tracker *FocusTracker) focusState() FocusState {
|
||||
if tracker.Idx < 0 {
|
||||
return NeverFocused
|
||||
return neverFocused
|
||||
}
|
||||
|
||||
for _, widget := range tracker.Widgets {
|
||||
if widget.TextView() == tracker.App.GetFocus() {
|
||||
return Widget
|
||||
return widgetFocused
|
||||
}
|
||||
}
|
||||
|
||||
return AppBoard
|
||||
return appBoardFocused
|
||||
}
|
||||
|
||||
func (tracker *FocusTracker) increment() {
|
||||
|
||||
@@ -57,9 +57,9 @@ func (widget *TextWidget) BorderColor() string {
|
||||
func (widget *TextWidget) ContextualTitle(defaultStr string) string {
|
||||
if widget.FocusChar() == "" {
|
||||
return fmt.Sprintf(" %s ", defaultStr)
|
||||
} else {
|
||||
return fmt.Sprintf(" %s [darkgray::u]%s[::-][green] ", defaultStr, widget.FocusChar())
|
||||
}
|
||||
|
||||
return fmt.Sprintf(" %s [darkgray::u]%s[::-][green] ", defaultStr, widget.FocusChar())
|
||||
}
|
||||
|
||||
func (widget *TextWidget) Disable() {
|
||||
|
||||
@@ -119,9 +119,9 @@ func RowColor(module string, idx int) string {
|
||||
|
||||
if idx%2 == 0 {
|
||||
return Config.UString(evenKey, "white")
|
||||
} else {
|
||||
return Config.UString(oddKey, "lightblue")
|
||||
}
|
||||
|
||||
return Config.UString(oddKey, "lightblue")
|
||||
}
|
||||
|
||||
func SigilStr(len, pos int, view *tview.TextView) string {
|
||||
|
||||
Reference in New Issue
Block a user