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

Minor code cleanup

This commit is contained in:
Chris Cummer
2018-09-24 08:52:57 -07:00
parent fb69547fc8
commit 9bd2430063
4 changed files with 44 additions and 16 deletions

View File

@@ -54,6 +54,9 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
widget.View.SetWrap(true)
widget.View.SetWordWrap(true)
widget.View.SetInputCapture(widget.keyboardIntercept)
widget.View.SetChangedFunc(func() {
app.Draw()
})
go widget.watchForFileChanges()
@@ -72,7 +75,7 @@ func (widget *Widget) Refresh() {
func (widget *Widget) display() {
title := fmt.Sprintf("[green]%s[white]", widget.CurrentSource())
widget.View.SetTitle(widget.ContextualTitle(title))
title = widget.ContextualTitle(title)
text := wtf.SigilStr(len(widget.Sources), widget.Idx, widget.View) + "\n"
@@ -82,6 +85,7 @@ func (widget *Widget) display() {
text = text + widget.plainText()
}
widget.View.SetTitle(title)
widget.View.SetText(text)
}