-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R: newlines have gone missing in messages #1878
Comments
The conditionMessage(rlang::catch_cnd(message("foo")))
#> [1] "foo\n" Compare to warnings: conditionMessage(rlang::catch_cnd(warning("foo")))
#> [1] "foo" That said it all happens within But that's not a big deal, I'll just add a newline if there isn't one already. We'll lose support for constructing messages piece by piece, i.e. like: message("Hello", appendLF = FALSE)
message("there", appendLF = TRUE) But that's a rather esoteric feature. |
Addressed by posit-dev/ark@da5fe14 |
Yes, ark 0.1.27, which includes the commit linked above, fixes this behaviour for me. Should we close this or wait to experience the fix in a release build? Seems possibly unnecessary because I'm not sure the problem ever made it into a release build (of Positron) either, i.e. Positron just skipped over ark 0.1.26 entirely. |
In the meantime a new build was released, so we can close this. |
I've reopened this issue because the fix for it, posit-dev/ark@da5fe14, caused a significant regression, #1919, in the Console. Basically, the regression is this: If you try to execute
You will see something like:
Which is all kinds of messed up. This is being caused by the fact that progress output like this is done using a CR (and / or ANSI escape sequences) to set the cursor position back to 0 so that the next line of progress output overwrites the previous line. For example, a progress output stream might look something like:
Which results in a final output of one line in the Console:
So, the fix in posit-dev/ark@da5fe14 causes these line erasures to fail resulting in output that shouldn't be visible once the progress output is compete because it is inserting LFs where there should just be CRs. |
See r-lib/rlang#1677 which I've just opened for context. Base and rlang messages behave differently regarding the inclusion of an explicit trailing line feed, which causes an ambiguity when handling both kinds of messages externally (in this case with our global handler that captures messages and redirect them to stdout). |
In Positron 2023.12.0 (Universal) build 1623 we see the correct behavior again: pak.movJust to reiterate once more, we have identified this kind of interaction (user types something in Console, we go all the way back to a real runtime to get output, then Console displays output) as important to get under automated testing at some level so we know when there is a regression, at the least with a nightly test run (if it's not possible to run every smoke test on every PR). |
I'm noticing a lack of newlines in messages in R. I haven't done a thorough study, but it's definitely affecting cli-emitted messages, e.g.:
which should instead be like this:
Presumably related to some loose ends in posit-dev/ark@fc13102. The output above corresponds to:
The text was updated successfully, but these errors were encountered: