diff options
| -rw-r--r-- | xA/xA.go | 21 | 
1 files changed, 19 insertions, 2 deletions
| @@ -182,6 +182,7 @@ var (  	// Widgets:  	wWindow     fyne.Window +	wTopic      *widget.RichText  	wRichText   *widget.RichText  	wRichScroll *container.Scroll  	wEntry      *widget.Entry @@ -308,7 +309,20 @@ func refreshIcon() {  }  func refreshTopic(topic []bufferLineItem) { -	// TODO(p): First off, add a topic, second, refresh it. +	wTopic.Segments = nil +	for _, item := range topic { +		wTopic.Segments = append(wTopic.Segments, &widget.TextSegment{ +			Text: item.text, +			Style: widget.RichTextStyle{ +				Alignment: fyne.TextAlignLeading, +				ColorName: item.color, +				Inline:    true, +				SizeName:  theme.SizeNameText, +				TextStyle: item.format, +			}, +		}) +	} +	wTopic.Refresh()  }  func refreshBufferList() { @@ -876,11 +890,14 @@ func main() {  	// TODO(p): There should also be a widget.NewLabel() next to the entry.  	//  - Probably another Border, even though this seems odd. +	wTopic = widget.NewRichText() +	wTopic.Truncation = fyne.TextTruncateEllipsis  	wRichText = widget.NewRichText()  	wRichText.Wrapping = fyne.TextWrapWord  	wRichScroll = container.NewVScroll(wRichText)  	wEntry = widget.NewMultiLineEntry() -	wWindow.SetContent(container.NewBorder(nil, wEntry, nil, nil, wRichScroll)) +	wWindow.SetContent(container.NewBorder( +		wTopic, wEntry, nil, nil, wRichScroll))  	go relayRun() | 
