Bug 5915 – Newlines are not propagated when copy&pasting code snippets
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-04-30T20:24:00Z
Last change time
2014-09-18T19:42:01Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2011-04-30T20:24:22Z
This only happens on d-programming-language.org.
If you try to copy&paste the first snippet from here:
http://d-programming-language.org/phobos/std_range.html
Pasted:
R r; // can define a range object if (r.empty) {} // can test for empty r.popFront; // can invoke next auto h = r.front; // can get the front of the range
Note that Bugzilla might add its own newlines to limit text width. But there's no newlines where there should be.
---
Copying from here:
http://www.digitalmars.com/d/2.0/phobos/std_range.html
Pasted:
R r; // can define a range object
if (r.empty) {} // can test for empty
r.popFront; // can invoke next
auto h = r.front; // can get the front of the range
On digitalmars.com it works ok.
Comment #1 by andrej.mitrovich — 2011-05-19T20:31:17Z
This is weird. If I try to copy code samples from http://d-programming-language.org/expression.html, newlines aren't saved.
But when I compile expression.html from my local branch, and copy a sample from my local file:///D:/dev/git/projects/d-programming-language.org/expression.html, then newlines *are* saved.
I wonder what's causing this behavior..
Comment #2 by andrej.mitrovich — 2011-09-01T10:15:19Z
Comment #4 by bearophile_hugs — 2012-02-06T19:10:55Z
(In reply to comment #2)
> Can anyone else confirm this?
Using Firefox10 when I copy and paste I don't see newlines, so I confirm the problem.
Comment #5 by andrej.mitrovich — 2012-02-07T02:04:31Z
(In reply to comment #3)
> Where are you pasting the snippets of code? I'm using Opera (Win 7) and the
> text from http://d-programming-language.org/phobos/std_range.html is correctly
> pasted in a plethora of text editors, and text boxes from web pages.
In a text editor that recognizes any form of newlines.
I can confirm that it works ok in Opera, but not in Firefox. So this is some sort of browser compatibility issue.
Comment #6 by smjg — 2012-02-10T11:11:23Z
(In reply to comment #5)
> I can confirm that it works ok in Opera, but not in Firefox. So this is some
> sort of browser compatibility issue.
Very puzzling. Clearly it's a bug in Firefox, so there should be a bug report somewhere on b.m.o for it. The question is what exactly is triggering it to bite.
But it seems to be happening only when viewing the page online - I haven't been able to reproduce it on a local copy of the page even after adding a base tag to make sure it gets all the CSS.
It also stops happening if I disable JavaScript. It would seem that the listanchors function (an abomination anyway) is doing something funny to the DOM under FF - after all, for some obscure reason it gets stuck in the load of my local copy and so listanchors isn't called.
Comment #7 by andrej.mitrovich — 2013-02-06T20:56:32Z
They seem to work for me now. Can bearophile and Stewart confirm?
Comment #8 by bearophile_hugs — 2013-02-07T02:50:27Z
(In reply to comment #7)
> They seem to work for me now. Can bearophile and Stewart confirm?
If I go in this page with the latest version of Firefox:
http://dlang.org/phobos/std_algorithm.html
And I copy the first example I get no newlines:
int[] a = ...; static bool greater(int a, int b) { return a > b; } sort!(greater)(a); // predicate as alias sort!("a > b")(a); // predicate as string // (no ambiguity with array name) sort(a); // no predicate, "a < b" is implicit
Comment #9 by smjg — 2013-02-07T03:54:19Z
(In reply to comment #7)
> They seem to work for me now. Can bearophile and Stewart confirm?
Still failing for me (Firefox 18.0.2 Win32). Andrej - what version are you using?
Comment #10 by andrej.mitrovich — 2014-04-23T12:59:27Z
(In reply to Stewart Gordon from comment #9)
> (In reply to comment #7)
> > They seem to work for me now. Can bearophile and Stewart confirm?
>
> Still failing for me (Firefox 18.0.2 Win32). Andrej - what version are you
> using?
Firefox 26.0.
Comment #11 by smjg — 2014-04-23T21:26:59Z
Can't seem to reproduce now (FF 28.0).
Comment #12 by hsteoh — 2014-09-18T19:42:01Z
Seems to work on Opera 12.16 and Firefox 31.1.0 (both on Linux/64). Doesn't look like it's a problem with dlang.org, or whatever it was, it has been since fixed.