sunshengfei / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
0 stars 0 forks source link

copy paste broken in IE7 (newlines are not preserved) #71

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Browse to
http://google-code-prettify.googlecode.com/svn/trunk/README.html using IE7
and copy the "Prettier" text block ("class Voila...")
2. Paste text into notepad
3.
(Please include HTML, not just your source code)

What is the expected output?  What do you see instead?

Expected:

class Voila {
public:
  // Voila
  static const string VOILA = "Voila";

  // will not interfere with embedded tags.
}

ACTUAL:

class Voila {public:  // Voila  static const string VOILA = "Voila";  //
will not interfere with embedded tags.}

What version are you using?  On what browser?

Version: top of trunk --
http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js

Browser: IE7 (7.0.5730.13)

Please provide any additional information below.

Newlines are preserved when using IE6, Firefox, Chrome...  just not IE7.  I
haven't checked IE8.

This looks similar to issues 21 and 46:
http://code.google.com/p/google-code-prettify/issues/detail?id=21
http://code.google.com/p/google-code-prettify/issues/detail?id=46
But those all mentioned IE6 as the culprit.  I am experiencing issues with IE7.

Original issue reported on code.google.com by fpars...@gmail.com on 2 Apr 2009 at 5:09

GoogleCodeExporter commented 8 years ago
I have to find a way to run IE7 before I can address this so it may take some 
time.
Do you know if the issue is apparent on IE8?

Original comment by mikesamuel@gmail.com on 14 Aug 2009 at 6:06

GoogleCodeExporter commented 8 years ago
It is an issue in IE8 as well as IE7. We've got a fix for it, which we're happy 
to 
share. What's the best way to submit it?

Original comment by MelHarb...@gmail.com on 16 Sep 2009 at 4:05

GoogleCodeExporter commented 8 years ago
Could you attach a diff to this issue?

Original comment by mikesamuel@gmail.com on 16 Sep 2009 at 6:07

GoogleCodeExporter commented 8 years ago
I'm attaching the whole prettify.js file with the fix applied. There's one other
change that we've made to the file, which is to the definition of PR_TAG - you 
may or
may not want that as well.

Original comment by MelHarb...@gmail.com on 17 Sep 2009 at 9:29

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by mikesamuel@gmail.com on 3 Oct 2009 at 8:51

GoogleCodeExporter commented 8 years ago
The attached code seems to use '\r' on IE 7 and 8 and '\r\n' on IE 6.  Isn't 
that
backwards?  Or am I just on crack?

Original comment by mikesamuel@gmail.com on 6 Oct 2009 at 5:16

GoogleCodeExporter commented 8 years ago
Mel, can you confirm which line break should be used on which version of IE?

Original comment by mikesamuel@gmail.com on 4 Nov 2009 at 8:24

GoogleCodeExporter commented 8 years ago
Hi Mike - Take a look at 
http://stackoverflow.com/questions/136443/why-doesnt-ie7-
copy-precode-blocks-to-the-clipboard-correctly/159582#159582 which contains 
more 
background info about this fix.

The approach detailed in that StackOverflow post is the same as Mel's: /r is 
the 
mapping for IE7/IE8, while /r/n is the mapping for IE6.

BTW, I've tested this fix on IE8 and it works great.

Original comment by justingr...@gmail.com on 23 Nov 2009 at 12:56

GoogleCodeExporter commented 8 years ago
Fixed at revision 89.  Please see
http://code.google.com/p/google-code-prettify/source/diff?spec=svn89&r=89&format
=side&path=/trunk/src/prettify.js#sc_svn88_1322
for the code that chooses the appropriate linebreak.

Original comment by mikesamuel@gmail.com on 23 Nov 2009 at 5:08