Skip to content

Commit

Permalink
disable flicker in details screen
Browse files Browse the repository at this point in the history
  • Loading branch information
cenkalti committed Feb 20, 2019
1 parent 2f37f8e commit 692d4be
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions internal/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (c *Console) updateLoop(g *gocui.Gui) {
select {
case <-ticker.C:
c.triggerUpdateTorrents()
c.triggerUpdateDetails()
c.triggerUpdateDetails(false)
case <-c.updateTorrentsC:
c.updateTorrents(g)
case <-c.updateDetailsC:
Expand Down Expand Up @@ -374,7 +374,7 @@ func (c *Console) setSelectedID(id string) {
changed := id != c.selectedID
c.selectedID = id
if changed {
c.triggerUpdateDetails()
c.triggerUpdateDetails(true)
}
}

Expand All @@ -387,7 +387,7 @@ func (c *Console) startTorrent(g *gocui.Gui, v *gocui.View) error {
if err != nil {
return err
}
c.triggerUpdateDetails()
c.triggerUpdateDetails(true)
return nil
}

Expand All @@ -400,36 +400,38 @@ func (c *Console) stopTorrent(g *gocui.Gui, v *gocui.View) error {
if err != nil {
return err
}
c.triggerUpdateDetails()
c.triggerUpdateDetails(true)
return nil
}

func (c *Console) switchGeneral(g *gocui.Gui, v *gocui.View) error {
c.m.Lock()
c.selectedTab = general
c.m.Unlock()
c.triggerUpdateDetails()
c.triggerUpdateDetails(true)
return nil
}

func (c *Console) switchTrackers(g *gocui.Gui, v *gocui.View) error {
c.m.Lock()
c.selectedTab = trackers
c.m.Unlock()
c.triggerUpdateDetails()
c.triggerUpdateDetails(true)
return nil
}

func (c *Console) switchPeers(g *gocui.Gui, v *gocui.View) error {
c.m.Lock()
c.selectedTab = peers
c.m.Unlock()
c.triggerUpdateDetails()
c.triggerUpdateDetails(true)
return nil
}

func (c *Console) triggerUpdateDetails() {
c.updatingDetails = true
func (c *Console) triggerUpdateDetails(clear bool) {
if clear {
c.updatingDetails = true
}
select {
case c.updateDetailsC <- struct{}{}:
default:
Expand Down

0 comments on commit 692d4be

Please sign in to comment.