commit f67d09c
sewn
·
2026-08-08 23:20:11 +0000 UTC
parent 3eac6eb
Show when message is missing in reply
1 files changed,
+11,
-8
+11,
-8
1@@ -641,16 +641,16 @@ func (bs *BufferList) resolveReply(netID, title, replyTo string) *Reply {
2 return nil
3 }
4
5-func (bs *BufferList) replyPreviewText(reply *Reply) StyledString {
6+func (bs *BufferList) replyPreviewText(nick, body StyledString) StyledString {
7 var sb StyledStringBuilder
8 sb.WriteStyledString(ColorString("╭─ ", bs.ui.config.Colors.Gray))
9
10- if reply == nil {
11+ if nick.string == "" {
12 sb.WriteStyledString(ColorString("(message not found)", bs.ui.config.Colors.Gray))
13 return sb.StyledString()
14 }
15
16- sb.WriteStyledString(reply.Nick)
17+ sb.WriteStyledString(nick)
18 sb.WriteStyledString(ColorString(": ", bs.ui.config.Colors.Gray))
19
20 snippet := strings.Map(func(r rune) rune {
21@@ -658,7 +658,7 @@ func (bs *BufferList) replyPreviewText(reply *Reply) StyledString {
22 return ' '
23 }
24 return r
25- }, reply.Body.string)
26+ }, body.string)
27 snippet = truncate(bs.ui.vx, snippet, max(bs.textWidth, 48), "…")
28 sb.WriteStyledString(ColorString(snippet, bs.ui.config.Colors.Gray))
29
30@@ -1465,14 +1465,17 @@ func (bs *BufferList) DrawTimeline(ui *UI, x0, y0, nickColWidth int) {
31 }
32
33 cY := yi
34- if line.Reply != nil {
35+ if line.ReplyTo != "" && yi >= y0 {
36 cY++
37- if yi >= y0 {
38- preview := bs.replyPreviewText(line.Reply)
39+ x := x0 + nickColWidth + 6
40+ if line.Reply != nil {
41+ preview := bs.replyPreviewText(line.Reply.Nick, line.Reply.Body)
42 preview.string = truncate(bs.ui.vx, preview.string,
43 nickColWidth+2+bs.textWidth, "…")
44- x := x0 + nickColWidth + 6
45 printString(vx, &x, yi, preview)
46+ } else {
47+ none := bs.replyPreviewText(StyledString{}, StyledString{})
48+ printString(vx, &x, yi, none)
49 }
50 }
51