r-lib / pillar

Format columns with colour
https://pillar.r-lib.org/
Other
178 stars 37 forks source link

tbl printing uses update_focus() #654

Closed eutwt closed 11 months ago

eutwt commented 11 months ago

So that the focus columns are updated according to (i.e. intersect()ed with) the current names

df <- tibble::as_tibble(as.list(setNames(letters, letters)))
attr(df, "pillar_focus") <- c('x', 'y')
df |> 
  dplyr::select(a)
#> # A tibble: 1 × 1
#>   a    
#>   <chr>
#> 1 a

In main this errors:

df <- tibble::as_tibble(as.list(setNames(letters, letters)))
attr(df, "pillar_focus") <- c('x', 'y')
df |> 
  dplyr::select(a)
#> Error in ctl_colonnade(df, has_row_id = if (.row_names_info(x) > 0) "*" else TRUE, : all(focus %in% names(x)) is not TRUE

Created on 2024-01-02 with reprex v2.0.2

eutwt commented 11 months ago

meant to open PR to my own fork for now