From 4329625cf49293eec6e66d8e601416a5222505e5 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Fri, 26 Dec 2025 11:56:24 +0100 Subject: [PATCH] Add margin to box headings --- src/musicplayer/ui/plot.gleam | 3 ++- test/musicplayer/ui/layout_test.gleam | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/musicplayer/ui/plot.gleam b/src/musicplayer/ui/plot.gleam index 32bd5be..3578018 100644 --- a/src/musicplayer/ui/plot.gleam +++ b/src/musicplayer/ui/plot.gleam @@ -57,8 +57,9 @@ pub fn box_with_heading( height: Int, heading: String, ) -> Buffer { + let heading_margin = 1 box(buffer, x, y, width, height) - |> text(heading, x, y) + |> text(heading, x + heading_margin, y) } fn horizontal_line( diff --git a/test/musicplayer/ui/layout_test.gleam b/test/musicplayer/ui/layout_test.gleam index dfe1cd4..9fc5490 100644 --- a/test/musicplayer/ui/layout_test.gleam +++ b/test/musicplayer/ui/layout_test.gleam @@ -58,8 +58,8 @@ pub fn percent_layout_test() { let expected = " ┌──────────────────────────────────────────────────────────────────────────────┐ -│row 1────────────────────────────────────────────────────────────────────────┐│ -││cell 1───────────────────────────────┐cell 2───────────────────────────────┐││ +│┌row 1───────────────────────────────────────────────────────────────────────┐│ +││┌cell 1──────────────────────────────┐┌cell 2──────────────────────────────┐││ │││ ││ │││ │││ ││ │││ │││ ││ │││ @@ -67,7 +67,7 @@ pub fn percent_layout_test() { │││ ││ │││ ││└────────────────────────────────────┘└────────────────────────────────────┘││ │└────────────────────────────────────────────────────────────────────────────┘│ -│row 1────────────────────────────────────────────────────────────────────────┐│ +│┌row 1───────────────────────────────────────────────────────────────────────┐│ ││ ││ ││ ││ ││ ││