Skip to content

Console width is not recognized at R session startupΒ #578

Open
@netique

Description

@netique

I want to print a nice welcome message at the RStudio project startup and I noticed that in the very first phases of an R session startup, it behaves as if the console is 80 characters wide. Note that it may be in fact the correct value and RStudio is only sluggish to set the console properties so they match what we see in the console pane.

Set this as your .Rprofile and restart the session:

# .Rprofile

cli::console_width()

setHook("rstudio.sessionInit", function(newSession) {
  print(cli::console_width())
}, action = "append")

Notice you get 80 no matter what in the first case. The second one is run only after the RStudio is fully available.

Glad to hear anyone else's opinion!

EDIT: Now I noticed in the cli source that 80 is the fallback value. Maybe this whole mission is not possible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions