Skip to content

Pasting Code in Editor has Wrong Colors

5 messages · Simon Urbanek, Brandon Hurr

#
As mentioned in the exchange with Frederico, I've been using Solarized Dark
colors for the console and editor to hopefully make long days of coding
easier on my eyes.

The issue is when I paste code from a webpage or email it appears to revert
to the original colors interspersed with the new background color. See this
image for an example: http://i.imgur.com/4n32Hx9.png

If I save the script and reload it, everything looks the way it should.
When the same code is pasted into R-GUI, everything is as it should be.

Thanks,
Brandon
2 days later
#
On Mar 4, 2016, at 12:10 PM, Brandon Hurr <brandon.hurr at gmail.com> wrote:

            
The paste option supports pasting attributes, so I wonder what is your source. If the source includes colors, the the source colors override your GUI setting - that is a standard Mac behavior (for better or worse). If you don't want that to happen, use "Paste as plain text" instead (<cmd><alt><V>)

Cheers,
Simon
#
Simon,

Thanks for the shortcut keys. I'll definitely use them.

As for your question about where it's coming from, mostly Chrome via
ggplot2/manipulatr mailing lists, and stackoverflow. As you say it will
retain the fonts and sizes and everything. I had tried CMD + Shift + V as
it is in gmail and it didn't work.

Coming from a naive standpoint, I'm unsure why pasting as plain text isn't
the default here. Is it inherited from OSX, and you have no choice?

I've thought about it a few times and I can't imagine why having decorated
text is useful in R-GUI at all but particularly the editor window. It
overrides colors, fonts, font sizes, until you save and reopen. Then
everything is like if you had pasted as plain text.

Thanks,
Brandon




On Sun, Mar 6, 2016 at 09:46 Simon Urbanek <simon.urbanek at r-project.org>
wrote:

  
  
#
Simon,

A follow up. On my system, "paste as plain text" does not fix the
color or font size issue when pasting. Below is my system information.
Session info ----------------------------------------------------------------------------------------------
 setting  value
 version  R version 3.2.3 (2015-12-10)
 system   x86_64, darwin13.4.0
 ui       AQUA
 language (EN)
 collate  en_US.UTF-8
 tz       America/Los_Angeles
 date     2016-03-07

Packages --------------------------------------------------------------------------------------------------
 package  * version     date       source
 devtools   1.10.0.9000 2016-02-26 Github (hadley/devtools at b6a23be)
 digest     0.6.9       2016-01-08 CRAN (R 3.2.3)
 memoise    1.0.0       2016-01-29 CRAN (R 3.2.3)
 withr      1.0.1       2016-02-04 CRAN (R 3.2.3)


Brandons-iMac:~ brandonhurr$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.11.3
BuildVersion: 15D21

Thanks,
Brandon
On Sun, Mar 6, 2016 at 9:01 PM, Brandon Hurr <brandon.hurr at gmail.com> wrote:
#
Ok, small, but important, further update.

When you paste something as plain text in the editor, it does in fact
work, but my mistake was that I pasted as normal first and then tried
to paste as plain second. It was still using the colors of the
previous paste.

Sorry for the noise, it does work.
On Mon, Mar 7, 2016 at 8:28 AM, Brandon Hurr <brandon.hurr at gmail.com> wrote: