
When running cat("\Hello\rBye") by itself you correctly get the output "Byelo". Whew, not a regression but a bug/quirk we've had for a while. Oh no, did I break something fundamental? I rushed to my laptop with 1.3 on it and tested there. I was testing what looked like a bug with the virtualconsole.js functionality running the Hello/Bye/1+1 example both as single sourced and multiple sourced lines but was worried when I saw it with the feature turned off. Sourcing one line at a time versus sourcing multiple lines at once gets different output. There is still an issue of some excess prompts related to carriage returns but they clean up with control+L now and it's an improvement over what's there at the moment.Ģ. I've added cleanup functions and my own ensureStartingOnNewLine (which fixes some weird prompt stuff also) to keep these more in sync but it adds complexity I don't like. It turns out that a lot of weirdness with newlines showing up where they should/shouldn't be was because the frontend is modifying it in certain places outside of the main R session submit() functions. This is not easy and it's compounded by many moving parts on the frontend modifying the console out of the void sometimes (see ensureStartingOnNewLine()). So what we try to do with virtualconsole.js is keep it in sync with all the other moving parts (VirtualConsole, ConsoleOutputWriter, the backend R session, the C++ state). When it inits we move all that content over and I assumed I just had to clean some stuff up in there. It doesn't init until the first time you write to the console so, due to some race conditions, you could have some non-virtualconsole.js content in there originally. My initial approach was assuming that it was just some junk left over from the virtualconsole.js initialization. The original issue: left over junk in the console, even upon a clear. I think it'll be very good for the health of this feature to have all these fixed but it's led me down some rabbit holes.ġ.


This ticket has turned into much more than it's seemed. Kevin managed to find test cases that exposed, at minimum, 3 bugs.
