mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Add a global Redraw method for TextWidget
Partially addresses #429, by centralizing widget drawing
This commit is contained in:
@@ -8,13 +8,12 @@ import (
|
||||
|
||||
func (widget *Widget) display() {
|
||||
repo := widget.currentGithubRepo()
|
||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings.Title, widget.title(repo))
|
||||
if repo == nil {
|
||||
widget.View.SetText(" GitHub repo data is unavailable ")
|
||||
widget.TextWidget.Redraw(title, " GitHub repo data is unavailable ", false)
|
||||
return
|
||||
}
|
||||
|
||||
widget.View.SetTitle(widget.ContextualTitle(fmt.Sprintf("%s - %s", widget.CommonSettings.Title, widget.title(repo))))
|
||||
|
||||
_, _, width, _ := widget.View.GetRect()
|
||||
str := widget.settings.common.SigilStr(len(widget.GithubRepos), widget.Idx, width) + "\n"
|
||||
str = str + " [red]Stats[white]\n"
|
||||
@@ -26,7 +25,7 @@ func (widget *Widget) display() {
|
||||
str = str + " [red]My Pull Requests[white]\n"
|
||||
str = str + widget.displayMyPullRequests(repo, widget.settings.username)
|
||||
|
||||
widget.View.SetText(str)
|
||||
widget.TextWidget.Redraw(title, str, false)
|
||||
}
|
||||
|
||||
func (widget *Widget) displayMyPullRequests(repo *GithubRepo, username string) string {
|
||||
|
||||
Reference in New Issue
Block a user