Fix CRAN Warning when non-breaking space in default function argument value #1343
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't have all the context of why there are non-breaking spaces introduced and afterwards replaced. Probably it was a Windows encoding issue already addressed on R-4.2, with its UTF-8 improvements.
The change in this pull request is as follows:
Before:
"<argument_name><space>=<space><default_value>"
for each argumentdefault_value
contains"\u{A0}"
(a non-breaking space character), the generated usage replaces that character with a regular space, leading to a CRAN warning due to the mismatch. (This is a bug, in my opinon)After:
"<argument_name><space>=<space><default_value>"
, as before.default_value
contains"\u{A0}"
(a non-breaking space character), the generated usage preserves that character and does not replace it anymore. May this cause rendering issues on older Windows using locales incompatible with nbsp? Maybe, but I would argue this hasn't happened until now (because if it had happened there would have been a CRAN Warning due to the bug mentioned above) and it probably won't happen after R4.2, since windows builds use UTF-8 there, as far as I know. So I would expect low chances of regressions.In the future, when R4.2 is required and assuming non-breaking spaces are well supported in R-4.2 Rd files, roxygen2 could use non-breaking spaces to wrap the
=
sign that separates the argument name from its default value. This is out of the scope of this pull request.