Duncan Murdoch
2014-09-03 11:56:33 UTC
The standard advice for reading the clipboard on OSX is to use the
pipe("pbpaste") connection, but I'm finding it misses the last line. (I
believe the last line in my examples generally doesn't include any EOL
marker.) For example, if I highlight these three lines:
line 1
line 2
line 3
and copy to the clipboard, then readLines(pipe("pbpaste")) gives
[1] "line 1" "line 2"
in R.app or R in a terminal. If I paste them here, I get
line 1
line 2
line 3
with the cursor left on the third line after the 3. In a console, echo
`pbpaste` gives
line 1 line 2 line 3
so the problem isn't (only) with pbpaste.
Duncan Murdoch
pipe("pbpaste") connection, but I'm finding it misses the last line. (I
believe the last line in my examples generally doesn't include any EOL
marker.) For example, if I highlight these three lines:
line 1
line 2
line 3
and copy to the clipboard, then readLines(pipe("pbpaste")) gives
[1] "line 1" "line 2"
in R.app or R in a terminal. If I paste them here, I get
line 1
line 2
line 3
with the cursor left on the third line after the 3. In a console, echo
`pbpaste` gives
line 1 line 2 line 3
so the problem isn't (only) with pbpaste.
Duncan Murdoch