1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Merge branch 'master' into todoistmulti

This commit is contained in:
Chris Cummer 2019-05-13 16:50:10 -07:00 committed by GitHub
commit 5620db2046
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 69 deletions

View File

@ -7,7 +7,6 @@ builds:
goos:
- darwin
- linux
- windows
goarch:
- 386
- amd64

View File

@ -2,6 +2,8 @@
## Unreleased
## v0.10.0
### ⚡️ Added
* DataDog module is now scrollable and interactive, by [@Seanstoppable](https://github.com/Seanstoppable)

View File

@ -53,21 +53,6 @@ func (list *Checklist) Delete() {
list.Prev()
}
// Demote moves the selected item down in the checklist
func (list *Checklist) Demote() {
if list.IsUnselectable() {
return
}
j := list.selected + 1
if j >= len(list.Items) {
j = 0
}
list.Swap(list.selected, j)
list.selected = j
}
// IsSelectable returns true if the checklist has selectable items, false if it does not
func (list *Checklist) IsSelectable() bool {
return list.selected >= 0 && list.selected < len(list.Items)
@ -78,14 +63,6 @@ func (list *Checklist) IsUnselectable() bool {
return !list.IsSelectable()
}
// Next selects the next item in the checklist
func (list *Checklist) Next() {
list.selected = list.selected + 1
if list.selected >= len(list.Items) {
list.selected = 0
}
}
// LongestLine returns the length of the longest checklist item's text
func (list *Checklist) LongestLine() int {
maxLen := 0
@ -99,29 +76,6 @@ func (list *Checklist) LongestLine() int {
return maxLen
}
// Prev selects the previous item in the checklist
func (list *Checklist) Prev() {
list.selected = list.selected - 1
if list.selected < 0 {
list.selected = len(list.Items) - 1
}
}
// Promote moves the selected item up in the checklist
func (list *Checklist) Promote() {
if list.IsUnselectable() {
return
}
j := list.selected - 1
if j < 0 {
j = len(list.Items) - 1
}
list.Swap(list.selected, j)
list.selected = j
}
func (list *Checklist) Selected() int {
return list.selected
}
@ -182,6 +136,54 @@ func (list *Checklist) Update(text string) {
item.Text = text
}
/* -------------------- Item Movement -------------------- */
// Prev selects the previous item UP in the checklist
func (list *Checklist) Prev() {
list.selected = list.selected - 1
if list.selected < 0 {
list.selected = len(list.Items) - 1
}
}
// Next selects the next item DOWN in the checklist
func (list *Checklist) Next() {
list.selected = list.selected + 1
if list.selected >= len(list.Items) {
list.selected = 0
}
}
// Promote moves the selected item UP in the checklist
func (list *Checklist) Promote() {
if list.IsUnselectable() {
return
}
k := list.selected - 1
if k < 0 {
k = len(list.Items) - 1
}
list.Swap(list.selected, k)
list.selected = k
}
// Demote moves the selected item DOWN in the checklist
func (list *Checklist) Demote() {
if list.IsUnselectable() {
return
}
j := list.selected + 1
if j >= len(list.Items) {
j = 0
}
list.Swap(list.selected, j)
list.selected = j
}
/* -------------------- Sort Interface -------------------- */
func (list *Checklist) Len() int {

View File

@ -216,25 +216,3 @@ func (widget *Widget) findGitRepositories(repositories []*GitRepo, directory str
return repositories
}
func (widget *Widget) Next() {
widget.Idx = widget.Idx + 1
if widget.Idx == len(widget.GitRepos) {
widget.Idx = 0
}
if widget.DisplayFunction != nil {
widget.DisplayFunction()
}
}
func (widget *Widget) Prev() {
widget.Idx = widget.Idx - 1
if widget.Idx < 0 {
widget.Idx = len(widget.GitRepos) - 1
}
if widget.DisplayFunction != nil {
widget.DisplayFunction()
}
}