HenrikBengtsson / startup

:wrench: R package: startup - Friendly R Startup Configuration
https://henrikbengtsson.github.io/startup/
163 stars 5 forks source link

RStudio Console: readline() is invisible during startup in RStudio Console #79

Closed HenrikBengtsson closed 4 years ago

HenrikBengtsson commented 4 years ago

With a ./.Rprofile file:

message(".Rprofile ...")
ans <- readline(prompt = "Press ENTER to continue: ")
message("You entered: ", sQuote(ans))
message(".Rprofile ... done")

we get the following when running R in the terminal:

$ R --quiet
.Rprofile ...
Press ENTER to continue: abc
You entered: ‘abc’
.Rprofile ... done
> 

However, in the RStudio Console (rstudio) we get:

.Rprofile ...
> abc
You entered: ‘abc’
.Rprofile ... done
>

Note how the prompt message is not displayed.

See also

HenrikBengtsson commented 4 years ago

Also, if the 'History' tab was previously selected in RStudio, the next time RStudio is started it will be selected again. Then, the input will be focused to the search box in the History tab rather than on the console where readline() is waiting for input.

rstudio_readline_during_startup

HenrikBengtsson commented 4 years ago

Ended up using a GUI dialog (Issue #80) so this issue is moot, at least, until fixed in RStudio.