diff options
Diffstat (limited to 'xA')
-rw-r--r-- | xA/xA.go | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -482,7 +482,7 @@ func convertBufferLine(m *RelayEventDataBufferLine) bufferLine { } } -func bufferPrintDateChange(sameline *bool, last, current time.Time) { +func bufferPrintDateChange(last, current time.Time) { last, current = last.Local(), current.Local() if last.Year() == current.Year() && last.Month() == current.Month() && @@ -490,11 +490,16 @@ func bufferPrintDateChange(sameline *bool, last, current time.Time) { return } - // TODO(p): Also print it. - // XXX: Not sure if "sameline" is appropriate with RichText. - _ = sameline - _ = current.Format(time.DateOnly) - *sameline = false + wRichText.Segments = append(wRichText.Segments, &widget.TextSegment{ + Style: widget.RichTextStyle{ + Alignment: fyne.TextAlignLeading, + ColorName: "", + Inline: false, + SizeName: theme.SizeNameText, + TextStyle: fyne.TextStyle{Bold: true}, + }, + Text: current.Format(time.DateOnly), + }) } func bufferPrintAndWatchTrailingDateChanges() { @@ -502,8 +507,7 @@ func bufferPrintAndWatchTrailingDateChanges() { b := bufferByName(bufferCurrent) if b != nil && len(b.lines) != 0 { last := b.lines[len(b.lines)-1].when - sameline := len(wRichText.Segments) == 0 - bufferPrintDateChange(&sameline, last, current) + bufferPrintDateChange(last, current) } // TODO(p): The watching part. @@ -519,9 +523,7 @@ func bufferPrintLine(lines []bufferLine, index int) { last = lines[index-1].when } - // XXX: Not sure if "sameline" is appropriate with RichText. - sameline := len(wRichText.Segments) == 0 - bufferPrintDateChange(&sameline, last, current) + bufferPrintDateChange(last, current) // TODO(p): Why don't the colour names work? texts := []widget.RichTextSegment{&widget.TextSegment{ |