Skip to content

Commit

Permalink
Fix multiple small issues with widget titles
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Cummer committed Jul 29, 2018
1 parent 34977f7 commit 3ce6dae
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bamboohr/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (widget *Widget) Refresh() {
)

widget.UpdateRefreshedAt()
widget.View.SetTitle(fmt.Sprintf("%s (%d)", widget.Name, len(todayItems)))
widget.View.SetTitle(fmt.Sprintf("%s (%d) ", widget.Name, len(todayItems)))

widget.View.SetText(widget.contentFrom(todayItems))
}
Expand Down
7 changes: 6 additions & 1 deletion cmdrunner/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ func (widget *Widget) Refresh() {

func (widget *Widget) String() string {
args := strings.Join(widget.args, " ")
return fmt.Sprintf(" %s %s ", widget.cmd, args)

if args != "" {
return fmt.Sprintf(" %s %s ", widget.cmd, args)
} else {
return fmt.Sprintf(" %s ", widget.cmd)
}
}

func (widget *Widget) execute() {
Expand Down
2 changes: 1 addition & 1 deletion github/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (widget *Widget) display() {
return
}

widget.View.SetTitle(fmt.Sprintf("%s- %s", widget.Name, widget.title(repo)))
widget.View.SetTitle(fmt.Sprintf("%s- %s ", widget.Name, widget.title(repo)))

str := wtf.SigilStr(len(widget.GithubRepos), widget.Idx, widget.View) + "\n"
str = str + " [red]Stats[white]\n"
Expand Down
7 changes: 6 additions & 1 deletion textfile/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"

"github.com/gdamore/tcell"
Expand Down Expand Up @@ -49,7 +50,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {

func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.View.SetTitle(fmt.Sprintf("%s %s", widget.Name, widget.filePath))
widget.View.SetTitle(fmt.Sprintf(" %s ", widget.fileName()))

filePath, _ := wtf.ExpandHomeDir(widget.filePath)

Expand Down Expand Up @@ -147,6 +148,10 @@ func (widget *Widget) Refresh() {

/* -------------------- Unexported Functions -------------------- */

func (widget *Widget) fileName() string {
return filepath.Base(widget.filePath)
}

func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
switch string(event.Rune()) {
case "/":
Expand Down

0 comments on commit 3ce6dae

Please sign in to comment.