From 2e9e0785c389581c07b924bcd3e3e15c33134fff Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Tue, 28 Jan 2025 19:33:51 +0200 Subject: Fixed wrapping issues of placeholder in viminput and also re-phrased some things --- internal/client/ui/core/chat/chat.go | 6 +++--- internal/client/ui/viminput/viminput.go | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'internal/client/ui') diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go index d1f0e8b..4e0466e 100644 --- a/internal/client/ui/core/chat/chat.go +++ b/internal/client/ui/core/chat/chat.go @@ -51,13 +51,13 @@ var ( Foreground(colors.LightGray).Padding(0, PaddingCount, 1). AlignHorizontal(lipgloss.Center).AlignVertical(lipgloss.Bottom). SetString("This frequency has no messages, start transmiting!") - NoAccess = NoMessages.SetString("You do not have permissions to see messages in this frequency") + NoAccess = NoMessages.SetString("You do not have permission to see messages in this frequency") SelectedGap = lipgloss.NewStyle().Background(colors.BackgroundDim) SendMessagePlaceholder = "Send a message..." - ReadOnlyPlaceholder = "You do not have permissions to send messages in this frequency" - MutedPlaceholder = "You have been muted by a server adminstrator" + ReadOnlyPlaceholder = "You do not have permission to send messages in this frequency" + MutedPlaceholder = "You have been muted by a network adminstrator" EditedIndicator = lipgloss.NewStyle(). Foreground(colors.LightGray).SetString(" (edited)").String() diff --git a/internal/client/ui/viminput/viminput.go b/internal/client/ui/viminput/viminput.go index 89f0d8d..53ba046 100644 --- a/internal/client/ui/viminput/viminput.go +++ b/internal/client/ui/viminput/viminput.go @@ -116,6 +116,8 @@ func (m Model) View() string { cursorStyle = InactiveCursorStyle } + m.PlaceholderStyle = m.PlaceholderStyle.Width(m.width) + var builder strings.Builder switch m.mode { case NormalMode, InsertMode, OpendingMode: @@ -125,9 +127,11 @@ func (m Model) View() string { } if len(m.lines) == 1 && len(line) == 0 && m.Placeholder != "" { - cursorChar := m.PlaceholderStyle.Render(m.Placeholder[0:1]) + cursorChar := cursorStyle. + Foreground(m.PlaceholderStyle.GetForeground()). + Render(m.Placeholder[0:1]) rest := m.PlaceholderStyle.Render(m.Placeholder[1:]) - builder.WriteString(cursorStyle.Render(cursorChar)) + builder.WriteString(cursorChar) builder.WriteString(rest) builder.WriteByte('\n') continue @@ -155,9 +159,11 @@ func (m Model) View() string { } if len(m.lines) == 1 && len(line) == 0 && m.Placeholder != "" { - cursorChar := m.PlaceholderStyle.Render(m.Placeholder[0:1]) + cursorChar := cursorStyle. + Foreground(m.PlaceholderStyle.GetForeground()). + Render(m.Placeholder[0:1]) rest := m.PlaceholderStyle.Render(m.Placeholder[1:]) - builder.WriteString(cursorStyle.Render(cursorChar)) + builder.WriteString(cursorChar) builder.WriteString(rest) builder.WriteByte('\n') continue @@ -261,9 +267,11 @@ func (m Model) View() string { } if len(m.lines) == 1 && len(line) == 0 && m.Placeholder != "" { - cursorChar := m.PlaceholderStyle.Render(m.Placeholder[0:1]) + cursorChar := cursorStyle. + Foreground(m.PlaceholderStyle.GetForeground()). + Render(m.Placeholder[0:1]) rest := m.PlaceholderStyle.Render(m.Placeholder[1:]) - builder.WriteString(cursorStyle.Render(cursorChar)) + builder.WriteString(cursorChar) builder.WriteString(rest) builder.WriteByte('\n') continue -- cgit v1.3.1