r-lib / gtable

The layout packages that powers ggplot2
https://gtable.r-lib.org
Other
87 stars 18 forks source link

Avoid partial match of `just` to `justification` #94

Closed teunbrand closed 6 months ago

teunbrand commented 9 months ago

This PR aims to fix https://github.com/tidyverse/ggplot2/issues/5654.

Briefly, when a viewport is provided to gtable(), it is reconstituted but the justification field is extracted via $just. This PR changes this to $justification, avoiding the partial match.

The reprex from https://github.com/tidyverse/ggplot2/issues/5654#issuecomment-1902198119 now does not throw an error:

devtools::load_all("~/packages/gtable/")
#> ℹ Loading gtable
library(grid)
options(warnPartialMatchDollar = TRUE)
options(warn = 2) 

gtable(
  widths = unit(1, "cm"),
  heights = unit(1, "cm"),
  vp = viewport()
)
#> TableGrob (1 x 1) "layout": 0 grobs

Created on 2024-01-23 with reprex v2.1.0

orichters commented 7 months ago

@thomasp85: It would be absolutely awesome if that could be merged. Thanks for the good work here!

MichaelChirico commented 6 months ago

cc @hadley could you please help to get this PR over the line? it's having a lot of effect on downstream packages that like to run tests under strict rules for partial matching

hadley commented 6 months ago

@MichaelChirico it seems like mere invocation of my name was sufficient 😆

orichters commented 5 months ago

Thanks a lot, @thomasp85!