Closed Bug 159354 Opened 23 years ago Closed 23 years ago

Linebreaks are not preserved when copying text from Chimera

Categories

(Camino Graveyard :: General, defect)

PowerPC
macOS
defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: cblackst, Assigned: bryner)

References

Details

Attachments

(2 files, 2 obsolete files)

1) I select a bunch of text in Chimera, about 20 lines of text, each line separated with a carriage return 2) I paste it into Word All other browsers paste the text into Word with the correct line formatting (line breaks at correct places) Chimera 0.4, however, runs all the text together, displaying the carriage returns as a Square, which I'm assuming is some sort of ASCII character
Chris, does it happen using Mozilla?
It does not happen with Mozilla 1.1b
something about encoding to Cocoa clipboard?
Assignee: saari → pinkerton
Blocks: 147975
i'm guessing we're missing some XP_MACOSX in the dom code or the like.
Assignee: pinkerton → bryner
related to bug 157635 - Pasting Text clipping incorrect form contents?
Nothing to do with bug 157635.
Status: NEW → ASSIGNED
I can occasionally reproduce this on a version of Mozilla I've built on Solaris, and I suspect a mach-o build on MacOSX. I havn't got a test case, but this may be a Mozilla bug.
Attached file Possible Testcase
One place where Mozilla doesn't insert line breaks when cutting and pasting is table rows. I'm not sure if this is the same problem as this bug, which would then be a Mozilla bug, or if this is a different bug. Ideally cutting and pasting the table should result in: line 1, cell 1line 1, cell 2 line 2, cell 1line 2, cell 2 but actually results in: line 1, cell 1line 1, cell 2 line 2, cell 1line 2, cell 2 Of course I dont' ahve Chimera around to test this on...
Attached patch patch v1 (obsolete) — Splinter Review
Ok, so one thing that makes this tricky is that files on OS X seem to generally use unix linebreaks, but it appears that we need text on the clipboard to use mac linebreaks to keep compatibility with non-Cocoa apps. This patch changes the line breaking any time we serialize html or plaintext, which fixes this problem... but I think a more correct fix might be to do this in the clipboard code. I'm not sure where exactly to do that at. Pink, Simon, what do you think?
Keywords: patch
Maybe akk can tell us all the places we need to fix the linebreaks. We are in a hybrid Mac/Unix world here. I would think that files that we save should have Unix linebreaks, but how does Word deal with those? It does make sense for the clipboard to have Mac linebreaks, as long as Cocoa apps are happen receiving such pastes too.
Summary: Carriage lines are not preserved when copying text from Chimera → Linebreaks are not preserved when copying text from Chimera
Most places should generally use NS_LINEBREAK, so if NS_LINEBREAK is \n for OS X, then you change the clipboard code to use \r instead, that might be all you need. That's set in nsCRT.h; I would think it would be better to change it there rather than just for the html and plaintext serializers (why not the xml serializer? What about later ones that might get added?) Are other places where OS X wants \r instead, so that would be a better default? A few places, like some mail code, use windows linebreaks (\r\n) rather than NS_LINEBREAK, so those will be broken for OS X just as they already are for mac and unix.
It appears that Cocoa apps (and I'm using TextEdit as my basis for this) can receive either unix or mac linebreaks ok from the clipboard, but Word only likes mac linebreaks. akkana, I'm not sure I follow what you're saying. At first you say we should change it just for the clipboard, then you say we should change NS_LINEBREAK in nsCRT.h. If we change NS_LINEBREAK in nsCRT.h we'll impact writing of files, so I'd prefer not to do that. Where would be the appropriate place to fix the line endings just for the clipboard?
Attached patch patch v2 (obsolete) — Splinter Review
This one converts linebreaks from unix to mac in nsClipboard, just before the text is placed on the clilpboard.
Attachment #93985 - Attachment is obsolete: true
What about drag and drop?
Attached patch patch v2.1Splinter Review
This fixes dragging text, too.
Attachment #94089 - Attachment is obsolete: true
Comment on attachment 94126 [details] [diff] [review] patch v2.1 use the same comment in both places (don't make someone open up another file to read about a 3 line comment) and r=pink
Comment on attachment 94126 [details] [diff] [review] patch v2.1 sr=sfraser
Attachment #94126 - Flags: superreview+
Blocks: 161815
*** Bug 161815 has been marked as a duplicate of this bug. ***
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
*** Bug 156285 has been marked as a duplicate of this bug. ***
No longer blocks: 147975
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: