mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
removed unused variable
This commit is contained in:
parent
977eb55944
commit
3c66bc9152
@ -15,15 +15,14 @@ func (widget *Widget) display() {
|
|||||||
|
|
||||||
str := ""
|
str := ""
|
||||||
checked := []*Item{}
|
checked := []*Item{}
|
||||||
uncheckedLen := 0
|
var selectedItem *Item
|
||||||
var selected *Item
|
|
||||||
var newList List
|
var newList List
|
||||||
for idx, item := range widget.list.Items {
|
for idx, item := range widget.list.Items {
|
||||||
foreColor, backColor := "white", "black"
|
foreColor, backColor := "white", "black"
|
||||||
|
|
||||||
// save the selected one
|
// save the selected one
|
||||||
if idx == widget.list.selected {
|
if idx == widget.list.selected {
|
||||||
selected = item
|
selectedItem = item
|
||||||
}
|
}
|
||||||
|
|
||||||
if item.Checked {
|
if item.Checked {
|
||||||
@ -31,9 +30,7 @@ func (widget *Widget) display() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
uncheckedLen++
|
if widget.View.HasFocus() && item == selectedItem {
|
||||||
|
|
||||||
if widget.View.HasFocus() && item == selected {
|
|
||||||
foreColor = Config.UString("wtf.mods.todo.colors.highlight.fore", "black")
|
foreColor = Config.UString("wtf.mods.todo.colors.highlight.fore", "black")
|
||||||
backColor = Config.UString("wtf.mods.todo.colors.highlight.back", "white")
|
backColor = Config.UString("wtf.mods.todo.colors.highlight.back", "white")
|
||||||
}
|
}
|
||||||
@ -53,7 +50,7 @@ func (widget *Widget) display() {
|
|||||||
for _, item := range checked {
|
for _, item := range checked {
|
||||||
foreColor, backColor := Config.UString("wtf.mods.todo.colors.checked", "white"), "black"
|
foreColor, backColor := Config.UString("wtf.mods.todo.colors.checked", "white"), "black"
|
||||||
|
|
||||||
if widget.View.HasFocus() && item == selected {
|
if widget.View.HasFocus() && item == selectedItem {
|
||||||
foreColor = Config.UString("wtf.mods.todo.colors.highlight.fore", "black")
|
foreColor = Config.UString("wtf.mods.todo.colors.highlight.fore", "black")
|
||||||
backColor = Config.UString("wtf.mods.todo.colors.highlight.back", "white")
|
backColor = Config.UString("wtf.mods.todo.colors.highlight.back", "white")
|
||||||
}
|
}
|
||||||
@ -70,9 +67,9 @@ func (widget *Widget) display() {
|
|||||||
newList.Items = append(newList.Items, item)
|
newList.Items = append(newList.Items, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
// update new index of selected item
|
// update selected index with new index of selected item
|
||||||
for idx, item := range newList.Items {
|
for idx, item := range newList.Items {
|
||||||
if item == selected {
|
if item == selectedItem {
|
||||||
newList.selected = idx
|
newList.selected = idx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user