summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-01-28 19:48:18 +0200
committerKyren223 <Kyren223@proton.me>2025-01-28 19:48:18 +0200
commit8c805499ece9cd32121e2a3366e86558609cfc50 (patch)
treed56bee9e08eb4ae4709a2d3e7dd2059c83073c50
parentf3bf8a9c5d7374118abd7937c59e8392847add85 (diff)
Fixed incorrect rendering of peers in the user signals when they are
trusted and their public key mismatches and also ellipsis when the username overflows the width
-rw-r--r--internal/client/ui/core/peerlist/peerlist.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/internal/client/ui/core/peerlist/peerlist.go b/internal/client/ui/core/peerlist/peerlist.go
index 0d8a678..dc2eaef 100644
--- a/internal/client/ui/core/peerlist/peerlist.go
+++ b/internal/client/ui/core/peerlist/peerlist.go
@@ -78,9 +78,6 @@ func (m Model) View() string {
peers = peers[m.base:upper]
for i, peer := range peers {
peerStyle := peerStyle
- if m.index == m.base+i {
- peerStyle = peerStyle.Background(colors.BackgroundHighlight)
- }
user := state.State.Users[peer]
trustedPublicKey, isTrusted := state.State.Trusteds[user.ID]
@@ -88,9 +85,14 @@ func (m Model) View() string {
var userStyle lipgloss.Style
if isTrusted && keysMatch {
- userStyle = ui.TrustedUserStyle
+ userStyle = ui.TrustedUserStyle.Background(colors.BackgroundDim)
} else {
- userStyle = ui.UserStyle
+ userStyle = ui.UserStyle.Background(colors.BackgroundDim)
+ }
+
+ if m.index == m.base+i {
+ peerStyle = peerStyle.Background(colors.BackgroundHighlight)
+ userStyle = userStyle.Background(colors.BackgroundHighlight)
}
username := user.Name
@@ -105,7 +107,8 @@ func (m Model) View() string {
Render(username)
} else {
ellipsisStyle := lipgloss.NewStyle().
- Background(peerStyle.GetBackground()).Foreground(userStyle.GetForeground())
+ Background(userStyle.GetBackground()).
+ Foreground(userStyle.GetForeground())
username = lipgloss.NewStyle().
MaxWidth(maxUserWidth-1).
Render(username) + ellipsisStyle.Render(ellipsis)