mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-05-20 01:32:33 +02:00
truncate title
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"charm.land/lipgloss/v2"
|
||||
"github.com/anotherhadi/spilltea/internal/icons"
|
||||
"github.com/anotherhadi/spilltea/internal/style"
|
||||
"github.com/charmbracelet/x/ansi"
|
||||
)
|
||||
|
||||
func (m Model) View() tea.View {
|
||||
@@ -38,6 +39,12 @@ func (m *Model) renderPanels(panelH int) string {
|
||||
if m.right.label != "" {
|
||||
rightTitle = icons.I.Diff + "Second: " + m.right.label
|
||||
}
|
||||
if maxW := leftW - 4; maxW > 0 {
|
||||
leftTitle = ansi.Truncate(leftTitle, maxW, "…")
|
||||
}
|
||||
if maxW := rightW - 4; maxW > 0 {
|
||||
rightTitle = ansi.Truncate(rightTitle, maxW, "…")
|
||||
}
|
||||
|
||||
leftBorder := s.Panel
|
||||
rightBorder := s.Panel
|
||||
|
||||
Reference in New Issue
Block a user