on main help sign in
fix(tui): splash: make sure we have a margin after the logo on small

screens

commit2929b21f4cfa8a23ed4199282e29bfc68becb4ec authorAyman Bagabas <ayman.bagabas@gmail.com> dateThu 17 Jul 2025, 15:02 (1 year ago) parent85b13fc
1 file changed+12−2
internal/tui/components/chat/splash/splash.go+12−2
internal/tui/components/chat/splash/splash.go+12−2
@@ -453,9 +453,19 @@ func (s *splashCmp) Cursor() *tea.Cursor {
453453 return nil
454454}
455455
456+func (s *splashCmp) isSmallScreen() bool {
457+ // Consider a screen small if either the width is less than 40 or if the
458+ // height is less than 20
459+ return s.width < 40 || s.height < 20
460+}
461+
456462func (s *splashCmp) infoSection() string {
457463 t := styles.CurrentTheme()
458− return t.S().Base.PaddingLeft(2).Render(
464+ infoStyle := t.S().Base.PaddingLeft(2)
465+ if s.isSmallScreen() {
466+ infoStyle = infoStyle.MarginTop(1)
467+ }
468+ return infoStyle.Render(
459469 lipgloss.JoinVertical(
460470 lipgloss.Left,
461471 s.cwd(),
@@ -469,7 +479,7 @@ func (s *splashCmp) infoSection() string {
469479func (s *splashCmp) logoBlock() string {
470480 t := styles.CurrentTheme()
471481 logoStyle := t.S().Base.Padding(0, 2).Width(s.width)
472− if s.width < 40 || s.height < 20 {
482+ if s.isSmallScreen() {
473483 // If the width is too small, render a smaller version of the logo
474484 // NOTE: 20 is not correct because [splashCmp.height] is not the
475485 // *actual* window height, instead, it is the height of the splash