Skip to content

Commit

Permalink
fix overflow padding of table
Browse files Browse the repository at this point in the history
  • Loading branch information
CrowdHailer committed Oct 22, 2023
1 parent 3f25896 commit 515de5c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions eyg/src/platforms/shell.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ fn print(value) {
let assert Ok(value) = r.field(rec, key)
let value = r.to_string(value)
let size = int.max(size, string.length(value))
let size = int.min(20, size)
let header = #(key, size)
let acc = [value, ..acc]
#(acc, header)
Expand Down Expand Up @@ -183,6 +184,7 @@ fn print(value) {
let #(#(key, size), value) = r
let value = string.inspect(value)
let size = int.max(size, string.length(value))
let size = int.min(20, size)
#(#(key, size), value)
},
)
Expand All @@ -209,6 +211,7 @@ fn print_rows_and_headers(headers, rows) -> Nil {
fn(part) {
let #(#(_, size), value) = part
string.pad_right(value, size, " ")
|> string.slice(0, size)
},
)
|> string.join(" | ")
Expand Down

0 comments on commit 515de5c

Please sign in to comment.