2

In R I can create a custom console prompt via:

options(prompt = "foo> ")

And I can use the crayon package to make it a certain color:

options(prompt = crayon::blue("foo> "))

However, in RStudio, color changes never take effect until the prompt is inactive; i.e. until I hit enter and the current line is replaced with a new prompt.

Like this:

enter image description here

The current console prompt is always yellow. Once I hit enter, a new yellow prompt appears and the previous line moves up and is colored blue.

I do not see this behavior when running R from the command line, the prompt immediately turns blue:

enter image description here

Is there a way around this in RStudio using crayon, or is RStudio short-circuiting the prompt formatting in a way that makes it impossible to fix without a change to the RStudio IDE (meaning I should report a bug/feature request with them)?

joran
  • 169,992
  • 32
  • 429
  • 468
  • Wouldn't this be because RStudio operates something like client/server (even as free desktop, not RStudio Pro) so in some sense the client is going to be 'behind'? Of just shoot me. – Chris Apr 06 '20 at 20:47
  • @Chris That is my suspicion as well, but I'm trying to exhaust all my options before pestering them with a bug/feature request. – joran Apr 06 '20 at 20:48
  • Not sure if this will help determine the bug/feature, but have you seen [watcher](https://github.com/brodieG/watcher)? As a manner of shinying down the pole, following execution... – Chris Apr 06 '20 at 20:52
  • just wondering did you get any further with this? – user63230 Oct 19 '20 at 13:17

0 Answers0