Skip to content
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

write_clip() adds some character #68

Open
TanguyBarthelemy opened this issue Jun 4, 2024 · 1 comment
Open

write_clip() adds some character #68

TanguyBarthelemy opened this issue Jun 4, 2024 · 1 comment

Comments

@TanguyBarthelemy
Copy link

TanguyBarthelemy commented Jun 4, 2024

I try to use write_clip() with some string.
When I call read_clip(), I get different results without changing the clipboard value:

library("clipr")
#> Welcome to clipr. See ?write_clip for advisories on writing to the clipboard in R.

write_clip("plot(AirPassengers)", allow_non_interactive = TRUE)
read_clip(allow_non_interactive = TRUE)
#> [1] "plot(AirPassengers)" "爀役慤慴慢敳"
read_clip(allow_non_interactive = TRUE)
#> [1] "plot(AirPassengers)" "嘀翶"
read_clip(allow_non_interactive = TRUE)
#> [1] "plot(AirPassengers)"
read_clip(allow_non_interactive = TRUE)
#> [1] "plot(AirPassengers)"                                     "爀浡≳嬺〳㤶ⱝ煚⩩退㈵㌷ㄹ〲昭㘰ⴶ搴愹愭㈰ⵢ㘵㔶〶昹ㄱ昵䔀)"

Also if I call utils::readClipboard(), I get the same results.

However, when I just paste the results with Ctrl + v (on Windows), every time I get plot(AirPassengers) with a new line (the expected result).

Also when I copy by hand and use read_clip(), I never get the additionnal character...

Thank you very much!

@TanguyBarthelemy
Copy link
Author

I just tested the function utils::writeClipboard() and I get the same problem.
I've also realised that it depends on the length of my character chain and the content!
For example, strings of length 9 are not affected by this change...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant