Open GoogleCodeExporter opened 9 years ago
UPDATE: I found a site with a good sample of this in action.
http://studiostyl.es/schemes/son-of-obsidian
The code samples in this theme gallery have line numbers, but you can freely
highlight the text to the right of the line numbers and not copy the line
numbers.
Original comment by alex.f...@codetunnel.com
on 3 Jun 2011 at 6:55
I am having trouble confirming the bug.
I am using Chrome and I copied the example from
http://google-code-prettify.googlecode.com/svn/trunk/README.html under "How do
I put line numbers in my code?" and pasted it below and I don't get line
numbers. Does that code snippet exhibit the problem for you?
// This is line 4.
foo();
bar();
baz();
boo();
far();
faz();
Original comment by mikesamuel@gmail.com
on 4 Jun 2011 at 9:50
Actually you're right, in Chrome it highlights the numbers but does not
actually copy them. However, I did open Firefox 3.6.17 and it does the
opposite. It does not highlight the line numbers, but DOES copy them. I checked
in IE 9 and it copies the numbers as well.
IE 9:
1.command.Parameters.Add(new SqlParameter("Username",
"Alex"));2.command.Parameters.Add(new SqlParameter("Password",
"Exp3rtC0d3r1"));3.command.Parameters.Add(new SqlParameter("Administrator", true
FF 3.6.17
1. command.Parameters.Add(new SqlParameter("Username", "Alex"));
2. command.Parameters.Add(new SqlParameter("Password", "Exp3rtC0d3r1"));
3. command.Parameters.Add(new SqlParameter("Administrator", true);
^^Direct pastes from
http://www.codetunnel.com/blog/post/73/introduction-to-entity-framework-part-i--
object-relational-mapping
No modifications made.
Here are pastes of the same text you tried to copy:
IE 9
// This is line 4.5.foo();bar();baz();boo();far();10.faz();
FF 3.6.17
4. // This is line 4.
5. foo();
6. bar();
7. baz();
8. boo();
9. far();
10. faz();
^^ Note that it has line numbers for every line in the pasted text from
firefox, even though only lines 5 and 10 had numbers on them in the
readme.html. Weird. Something to do with the way FF decides to copy ordered
lists I assume.
Anyway in all three browsers, the line numbered text on
http://studiostyl.es/schemes/son-of-obsidian does not include numbers when you
copy. And in all three browsers the numbers do not appear to highlight with the
text you are highlighting. That's the functionality I would love to see in
prettify :)
Original comment by alex.f...@codetunnel.com
on 4 Jun 2011 at 10:04
Update: Now that I am at my normal computer, here is a paste from Firfox 4.0
// This is line 4.
foo();
bar();
baz();
boo();
far();
faz();
Looks like they changed the way it pastes ordered lists now. I am still
interested in preventing line number pasting more natively than depending on
the browser to decide. CodeTunnel.com, the site I use prettify with, tries to
be backward compatible with most browser versions. It would be awesome if it
worked like the sample I linked to.
Original comment by alex.f...@codetunnel.com
on 5 Jun 2011 at 3:20
Thanks for the cross-browser comparison.
I agree that cross-browser support of copy-paste is important, and the IE 9
behavior is just horrible. Ideally I would like a solution that does both that
and degrades well when width is limited and source code uses
white-space:pre-wrap.
http://code.google.com/p/google-code-prettify/source/browse/trunk/src/prettify.c
ss uses a table instead of an ordered list to display code. Such an approach
might work. A table with one cell to the left containing the numbers and
another on the right would work, but would be fragile when the right cell has
white-space:pre-wrap.
Original comment by mikesamuel@gmail.com
on 5 Jun 2011 at 4:15
Keep me posted on what you figure out. I'll be watching for updates and am
excited to see if this gets implemented.
Original comment by alex.f...@codetunnel.com
on 6 Jun 2011 at 3:22
Will do. I think if you keep this issue starred, you should be notified when I
update it.
Original comment by mikesamuel@gmail.com
on 6 Jun 2011 at 4:38
Indeed I am ;)
Original comment by alex.f...@codetunnel.com
on 6 Jun 2011 at 4:39
Original issue reported on code.google.com by
alex.f...@codetunnel.com
on 3 Jun 2011 at 5:44