Rstudio resets width option when running shiny app in Viewer

shiny

#1

When I run a shiny app in the Rstudio Viewer options(width = ...) is reset by Rstudio. When I set options(width = 250) in global.R this seems to be ignored completely. Is there a way to change this behavior in Rstudio?

Also, Viewer seems to ignore CSS for handling overflow (see below). The CSS does work in Chrome and Firefox.

pre, code, pre code {
  overflow: auto;
}

EDIT:

It seems options(width = …) is actually reset when you change the width of the Viewer window. As an example, if you open the app below in Viewer and change the size of the Viewer window getOption("width") will not return 250

library(shiny)

options(width = 250)

# Define UI for application that draws a histogram
ui <- fluidPage(
  tags$head(tags$style(HTML("pre { overflow: auto; }"))),
  verbatimTextOutput("df")
)

# Define server logic required to draw a histogram
server <- function(input, output) {
   output$df <- renderPrint({
     data.frame(matrix(1:60, ncol = 60))
   })
}

# Run the application 
shinyApp(ui = ui, server = server)

EDIT2:

Better example posted to GitHub @ https://github.com/rstudio/rstudio/issues/1870


Wrap text output that is rendered with textOutput()