diff --git a/R/ctl_pillar_component.R b/R/ctl_pillar_component.R index 4b8e30eb6..cbcac87a0 100644 --- a/R/ctl_pillar_component.R +++ b/R/ctl_pillar_component.R @@ -108,7 +108,7 @@ pillar_format_parts_2 <- function(x, width) { flat <- unlist(formatted) extent <- get_extent(flat) - aligned <- align_impl(flat, width, align, " ", extent) + aligned <- align_impl(flat, min(width, max(extent)), align, " ", extent) new_tbl(list( formatted = list(formatted), align = align, flat = list(flat), diff --git a/tests/testthat/_snaps/format_character.md b/tests/testthat/_snaps/format_character.md index c7086e02b..ed944a973 100644 --- a/tests/testthat/_snaps/format_character.md +++ b/tests/testthat/_snaps/format_character.md @@ -68,16 +68,16 @@ pillar(add_special(c("\t")), width = 10) Output - - "\t" - + + "\t" + Code pillar(add_special(c("a\nb")), width = 10) Output - - "a\nb" - + + "a\nb" + Code pillar(add_special(c("a\001b")), width = 10) Output diff --git a/tests/testthat/_snaps/format_list_of.md b/tests/testthat/_snaps/format_list_of.md index df4737299..0ca86d542 100644 --- a/tests/testthat/_snaps/format_list_of.md +++ b/tests/testthat/_snaps/format_list_of.md @@ -4,9 +4,9 @@ pillar(v, width = 15) Output - > - [1] - [3] + > + [1] + [3] --- @@ -14,6 +14,6 @@ pillar(v, width = 30) Output - > - SC + > + SC diff --git a/tests/testthat/_snaps/format_survival.md b/tests/testthat/_snaps/format_survival.md index 6c12394b7..b61c2babf 100644 --- a/tests/testthat/_snaps/format_survival.md +++ b/tests/testthat/_snaps/format_survival.md @@ -4,13 +4,13 @@ pillar(x, width = 20) Output - - 306 - 455 - 1010+ - 210 - 883 - 1022+ + + 306 + 455 + 1010+ + 210 + 883 + 1022+ --- @@ -18,11 +18,11 @@ pillar(x, width = 20) Output - - 306:2 - 455:2 - 1010+ - 210:2 - 883:2 - 1022+ + + 306:2 + 455:2 + 1010+ + 210:2 + 883:2 + 1022+ diff --git a/tests/testthat/_snaps/format_unspecified.md b/tests/testthat/_snaps/format_unspecified.md index 63d1a03aa..050179403 100644 --- a/tests/testthat/_snaps/format_unspecified.md +++ b/tests/testthat/_snaps/format_unspecified.md @@ -4,8 +4,8 @@ pillar(vctrs::unspecified(3), width = 10) Output - - . - . - . + + . + . + . diff --git a/tests/testthat/_snaps/type_sum.md b/tests/testthat/_snaps/type_sum.md index 9d593da0c..956f1b015 100644 --- a/tests/testthat/_snaps/type_sum.md +++ b/tests/testthat/_snaps/type_sum.md @@ -14,9 +14,9 @@ new_tbl(new_tbl(list(foo = foo, bar = bar))) Output # A data frame: 3 x 2 - foo bar - AsIs SC - 1 2011 2011 - 2 2012 2012 - 3 2013 2013 + foo bar + AsIs SC + 1 2011 2011 + 2 2012 2012 + 3 2013 2013