summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-02-10 17:40:10 +0200
committerKyren223 <Kyren223@proton.me>2025-02-10 17:40:10 +0200
commit93500cdd8b6b726df5682de10449cd1f82271eaa (patch)
tree68fe9cca7c42571cc60f81f220b76a76d71e93f4
parent56e658c7dbe982d8c4ccdcfdd1e3e0d5dc621fcd (diff)
Fixed edited indicator not matching the background when a message was
ping-highlighted
-rw-r--r--internal/client/ui/core/chat/chat.go33
1 files changed, 13 insertions, 20 deletions
diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go
index 12823c2..b8a2075 100644
--- a/internal/client/ui/core/chat/chat.go
+++ b/internal/client/ui/core/chat/chat.go
@@ -75,24 +75,14 @@ var (
MutedPlaceholder = "You have been muted by a network adminstrator"
SelectSignalOrFrequency = "Cannot send messages, select a signal or frequency first"
- EditedIndicator = func() string {
- return lipgloss.NewStyle().Background(colors.Background).
+ EditedIndicator = func(bg lipgloss.Color) string {
+ return lipgloss.NewStyle().Background(bg).
Foreground(colors.LightGray).SetString(" (edited)").String()
}
- EditedIndicatorNL = func() string {
- return lipgloss.NewStyle().Background(colors.Background).
+ EditedIndicatorNL = func(bg lipgloss.Color) string {
+ return lipgloss.NewStyle().Background(bg).
Foreground(colors.LightGray).SetString(" (edited)").String()
}
- SelectedEditedIndicator = func() string {
- return lipgloss.NewStyle().
- Foreground(colors.LightGray).Background(colors.BackgroundDim).
- SetString(" (edited)").String()
- }
- SelectedEditedIndicatorNL = func() string {
- return lipgloss.NewStyle().
- Foreground(colors.LightGray).Background(colors.BackgroundDim).
- SetString("\n(edited)").String()
- }
WidthWithoutVi = PaddingCount*2 + lipgloss.Width(LeftCorner) + lipgloss.Width(RightCorner)
@@ -1167,11 +1157,12 @@ func (m *Model) renderMessageGroup(group []data.Message, remaining *int, height
content := messageStyle.Render(rawContent)
heights[i] = lipgloss.Height(content)
if group[i].Edited {
+ color := backgroundStyle.GetBackground().(lipgloss.Color)
before := heights[i]
- content = messageStyle.Render(rawContent + EditedIndicator())
+ content = messageStyle.Render(rawContent + EditedIndicator(color))
heights[i] = lipgloss.Height(content)
if before != heights[i] {
- content = messageStyle.Render(rawContent + EditedIndicatorNL())
+ content = messageStyle.Render(rawContent + EditedIndicatorNL(color))
heights[i] = lipgloss.Height(content)
}
}
@@ -1252,11 +1243,12 @@ func (m *Model) renderMessageGroup(group []data.Message, remaining *int, height
rawContent = extra + rawContent
content := selectedStyle.Render(rawContent)
if group[selectedIndex].Edited {
+ color := selectedBackgroundStyle.GetBackground().(lipgloss.Color)
before := lipgloss.Height(content)
- content = selectedStyle.Render(rawContent + SelectedEditedIndicator())
+ content = selectedStyle.Render(rawContent + EditedIndicator(color))
after := lipgloss.Height(content)
if before != after {
- content = selectedStyle.Render(rawContent + SelectedEditedIndicatorNL())
+ content = selectedStyle.Render(rawContent + EditedIndicatorNL(color))
}
}
@@ -1305,11 +1297,12 @@ func (m *Model) renderMessageGroup(group []data.Message, remaining *int, height
content := messageStyle.Render(rawContent)
heights[i] = lipgloss.Height(content)
if group[i].Edited {
+ color := backgroundStyle.GetBackground().(lipgloss.Color)
before := heights[i]
- content = messageStyle.Render(rawContent + EditedIndicator())
+ content = messageStyle.Render(rawContent + EditedIndicator(color))
heights[i] = lipgloss.Height(content)
if before != heights[i] {
- content = messageStyle.Render(rawContent + EditedIndicatorNL())
+ content = messageStyle.Render(rawContent + EditedIndicatorNL(color))
heights[i] = lipgloss.Height(content)
}
}