1
0
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:
Chris Cummer
2018-08-03 05:40:39 -07:00
parent 1f27cf5b00
commit 72c192cabf
12 changed files with 38 additions and 37 deletions

View File

@@ -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 {

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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 {