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

Fix a number of minor bugs in the Twitter module

This commit is contained in:
Chris Cummer 2019-04-26 06:11:55 -07:00
parent 3958177a8e
commit 879fa92777

View File

@ -12,11 +12,12 @@ import (
) )
const HelpText = ` const HelpText = `
Keyboard commands for Textfile: Keyboard commands for Twitter:
/: Show/hide this help window /: Show/hide this help window
h: Previous Twitter name h: Previous Twitter name
l: Next Twitter name l: Next Twitter name
o: Open the Twitter handle in a browser
arrow left: Previous Twitter name arrow left: Previous Twitter name
arrow right: Next Twitter name arrow right: Next Twitter name
@ -84,7 +85,7 @@ func (widget *Widget) display() {
} }
_, _, width, _ := widget.View.GetRect() _, _, width, _ := widget.View.GetRect()
str := widget.settings.common.SigilStr(len(widget.Sources), widget.Idx, width) + "\n" str := widget.settings.common.SigilStr(len(widget.Sources), widget.Idx, width-2) + "\n"
for _, tweet := range tweets { for _, tweet := range tweets {
str = str + widget.format(tweet) str = str + widget.format(tweet)
} }
@ -156,7 +157,7 @@ func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
widget.Next() widget.Next()
return nil return nil
case "o": case "o":
wtf.OpenFile(widget.CurrentSource()) wtf.OpenFile(widget.currentSourceURI())
return nil return nil
} }
@ -171,3 +172,8 @@ func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
return event return event
} }
} }
func (widget *Widget) currentSourceURI() string {
src := "https://twitter.com/" + widget.CurrentSource()
return src
}