Thread overview
[Issue 5915] New: Newlines are not propagated when copy&pasting code snippets
May 01, 2011
Andrej Mitrovic
May 20, 2011
Andrej Mitrovic
Sep 01, 2011
Andrej Mitrovic
Feb 07, 2012
Yao Gomez
Feb 07, 2012
Andrej Mitrovic
Feb 10, 2012
Stewart Gordon
Feb 07, 2013
Andrej Mitrovic
Feb 07, 2013
Stewart Gordon
May 01, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5915

           Summary: Newlines are not propagated when copy&pasting code
                    snippets
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-04-30 20:24:22 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5915



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-19 20:31:17 PDT ---
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..

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 01, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5915



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-09-01 10:15:19 PDT ---
Can anyone else confirm this?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5915


Yao Gomez <yao.gomez@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yao.gomez@gmail.com


--- Comment #3 from Yao Gomez <yao.gomez@gmail.com> 2012-02-06 18:49:43 PST ---
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.

I also tested http://d-programming-language.org/expression.html and it seems to work right.

WORKSFORME.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5915


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #4 from bearophile_hugs@eml.cc 2012-02-06 19:10:55 PST ---
(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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5915



--- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-02-07 02:04:31 PST ---
(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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5915


Stewart Gordon <smjg@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com


--- Comment #6 from Stewart Gordon <smjg@iname.com> 2012-02-10 11:11:23 PST ---
(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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5915



--- Comment #7 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-06 20:56:32 PST ---
They seem to work for me now. Can bearophile and Stewart confirm?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5915



--- Comment #8 from bearophile_hugs@eml.cc 2013-02-07 02:50:27 PST ---
(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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5915



--- Comment #9 from Stewart Gordon <smjg@iname.com> 2013-02-07 03:54:19 PST ---
(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?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------