WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 58449
Web Inspector: TextViewer and TextEditorModel must support both \n and \r\n as line separators
https://bugs.webkit.org/show_bug.cgi?id=58449
Summary
Web Inspector: TextViewer and TextEditorModel must support both \n and \r\n a...
Alexander Pavlov (apavlov)
Reported
2011-04-13 09:30:38 PDT
Currently the text editor relies on \n being the only line separator. DOS files have \r\n as line separators, and they should be preserved when the text is retrieved from the text editor (e.g. when saving edited stylesheets).
Attachments
Patch
(6.63 KB, patch)
2011-04-14 05:26 PDT
,
Andrey Adaikin
no flags
Details
Formatted Diff
Diff
Patch
(5.72 KB, patch)
2011-04-14 06:28 PDT
,
Andrey Adaikin
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Andrey Adaikin
Comment 1
2011-04-14 05:26:02 PDT
Created
attachment 89560
[details]
Patch
Alexander Pavlov (apavlov)
Comment 2
2011-04-14 05:34:17 PDT
Comment on
attachment 89560
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=89560&action=review
> Source/WebCore/inspector/front-end/SourceFrame.js:40 > + this._textModel.useWindowsLineBreaks = (WebInspector.platform === "windows");
You seem to detect the line break model based on the client OS, while a browser can load pages authored on any OS. You should analyze the input to detect the input document line break model instead.
Andrey Adaikin
Comment 3
2011-04-14 06:28:51 PDT
Created
attachment 89573
[details]
Patch
Alexander Pavlov (apavlov)
Comment 4
2011-04-14 06:58:19 PDT
Comment on
attachment 89573
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=89573&action=review
Looks good, with one comment.
> Source/WebCore/inspector/front-end/TextEditorModel.js:119 > + var newLines = text.split(/\r?\n/);
Why not this._lineBreak ? It would be consistent with the "join" counterpart calls below.
Andrey Adaikin
Comment 5
2011-04-14 07:12:11 PDT
Just to deal with weird cases of mixed line breaks, if any. We never want invisible chars (like \r) to appear in the text editor, because there will be editing artefacts, like deleting zero-width invisible characters...
Alexander Pavlov (apavlov)
Comment 6
2011-04-14 07:18:02 PDT
(In reply to
comment #5
)
> Just to deal with weird cases of mixed line breaks, if any. We never want invisible chars (like \r) to appear in the text editor, because there will be editing artefacts, like deleting zero-width invisible characters...
I get it. Fair point. Waiting for someone to r+.
WebKit Commit Bot
Comment 7
2011-04-15 09:30:01 PDT
Comment on
attachment 89573
[details]
Patch Clearing flags on attachment: 89573 Committed
r83983
: <
http://trac.webkit.org/changeset/83983
>
WebKit Commit Bot
Comment 8
2011-04-15 09:30:12 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug