Summary: | Web Inspector: CodeMirror in resource content view should not show 'CR' characters | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | BJ Burg <bburg> | ||||
Component: | Web Inspector | Assignee: | Devin Rousso <hi> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | bburg, commit-queue, hi, joepeck, mattbaker, nvasilyev, simon.fraser, timothy, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | WebKit Nightly Build | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
URL: | http://www.tractorsupply.com/tsc/catalog/home-garden/outdoor-power-equipment/generators?cm_re=20160725-_-FOURTH-_-Portable+Generators | ||||||
Attachments: |
|
Description
BJ Burg
2016-08-02 14:40:18 PDT
https://github.com/WebKit/webkit/blob/c20f470adf2cf34821a0756d01a4df33b353c1e6/Source/WebInspectorUI/UserInterface/External/CodeMirror/codemirror.js#L6951 This appears to be hardcoded in CodeMirror, i.e. CodeMirror doesn't seem to provide an option to turn it off. We may have to modify codemirror.js directly. I don't think editing codemirror.js is going to be the right fix. Here are some alternatives: 1. Heuristically detect whether the line endings seem to be \r\n or \n and tell CodeMirror which line ending to assume (there's a setting for that) 2. Strip line endings from the text that we display (somewhat dangerous due to line:col interactions with JSC) 3. Tag the CR character with CSS and make it visibility:none. (In reply to comment #3) > I don't think editing codemirror.js is going to be the right fix. Here are > some alternatives: > > 1. Heuristically detect whether the line endings seem to be \r\n or \n and > tell CodeMirror which line ending to assume (there's a setting for that) This is what Chrome seems to do. https://codereview.chromium.org/19540026/ > 2. Strip line endings from the text that we display (somewhat dangerous due > to line:col interactions with JSC) > 3. Tag the CR character with CSS and make it visibility:none. I can't figure out how to write a valid CSS selector for this element: <span class="cm-invalidchar" cm-text=" ">␍</span> These don't work: .cm-invalidchar[cm-text=" "] .cm-invalidchar[cm-text="\n"] .cm-invalidchar[cm-text="\a"] We could just hide all .cm-invalidchar. This should be a setting switch once we have a Settings view. Created attachment 287986 [details]
Patch
Comment on attachment 287986 [details]
Patch
How does this look on misencoded files? Is there any way to differentiate CR from other invalid characters?
(In reply to comment #7) > How does this look on misencoded files? Is there any way to differentiate CR > from other invalid characters? Not really sure if I tested that. Any sure-fire steps for reproducing a mis-encoded file? What would that even look like? Comment on attachment 287986 [details]
Patch
r=me
(In reply to comment #8) > (In reply to comment #7) > > How does this look on misencoded files? Is there any way to differentiate CR > > from other invalid characters? > > Not really sure if I tested that. Any sure-fire steps for reproducing a > mis-encoded file? What would that even look like? On second thought, I've only really seen this on XHR responses that had the wrong MIME type. I think Johan fixed a bug in that area. Not sure this would really make it any worse... Comment on attachment 287986 [details] Patch Clearing flags on attachment: 287986 Committed r205517: <http://trac.webkit.org/changeset/205517> All reviewed patches have been landed. Closing bug. |