From 4aebe3b0e5aa8af56b8749f69afc906bcf71c228 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Sat, 9 Nov 2024 08:50:19 +0100 Subject: WIP: xA: topic --- xA/xA.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'xA/xA.go') diff --git a/xA/xA.go b/xA/xA.go index 438c9c4..3934849 100644 --- a/xA/xA.go +++ b/xA/xA.go @@ -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() -- cgit v1.2.3-70-g09d2