Use tab-size:4 in view-source
Reported by
fversche...@gmail.com,
Mar 29 2016
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0 Steps to reproduce the problem: Open a page indented with tab characters in View Source mode, e.g. view-source:http://fvsch.com/code/remarkdown/ What is the expected behavior? Each tab character should take the width of 4 spaces. What went wrong? Each tab character takes the width of 8 spaces. Did this work before? No Chrome version: 51.0.2693.2 canary (64-bit) Channel: canary OS Version: 10.0 Flash Version: Shockwave Flash 21.0 r0 Though 8ch is the standard width for a tab character in HTML, and this should not be changed for general web content, showing tab characters with a width of 4ch is the most common default setting in text editors and IDEs. It's also the width used in: - Chrome Web Inspector's "Edit as HTML" and Sources view. - Firefox's view-source (their "Edit as HTML" view uses 2ch, probably for a more compact information display). For consistency's sake I recommend using tab-size:4 in the view-source pages.
,
Mar 30 2016
Tested the same on win8.1 chrome version 51.0.2694.1 canary - observed that tab-size:4 is taken for each tab character as shown in the screenshot Could you please attach a screenshot/screencast for better understanding of the issue
,
Mar 30 2016
This bug is about the "View Source" view in Chromium, not platform support for CSS's tab-size. Sorry if that wasn't clear. In the attached screenshot, the indentation in lines 4-8 is a single "tab" character, which is rendered with a width equivalent to 8 spaces. I'm suggesting using a width of 4 spaces. (If by chance that view is built in HTML/XML and CSS, that could be as simple as adding tab-size:4 to its stylesheet.)
,
Mar 31 2016
The old bug ticket was https://bugs.chromium.org/p/chromium/issues/detail?id=598632.
,
Mar 31 2016
I'll do a compile and see if setting tab-size in the CSS itself works. It does work when changing it in DevTools, so I don't see why the original patch wouldn't work. I can confirm that `view-source` is using 8 spaces instead of 4 for tab characters.
,
Mar 31 2016
If the `tab-size` value for `view-source:` URLs is changed, it should be changed to `2` rather than `4` to match the DevTools DOM view indentation.
,
Mar 31 2016
Not sure about the `2` value. In DevTools: - "Elements > Edit as HTML" uses `4`. - "Sources" uses `4` as well. Do you advocate changing it across the board?
,
Mar 31 2016
- "sources" is configurable in settings, 4 is default. - Edit as HTML in Elements does an actual tab character. 2 is how the Elements panel itself represents indentation of nodes. So going with 2 is the best choice to align with that. CL [1] is open for the update to 2 spaces for tabs. [1] https://codereview.chromium.org/1845923002
,
Apr 4 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/0a353ab8c75241ef2e1101bcf5e2e23ae32a1fbf commit 0a353ab8c75241ef2e1101bcf5e2e23ae32a1fbf Author: jonathan.garbee <jonathan.garbee@chromium.org> Date: Mon Apr 04 14:57:06 2016 4 spaces for tab size in view source. BUG= 598632 Review URL: https://codereview.chromium.org/1845923002 Cr-Commit-Position: refs/heads/master@{#384906} [modify] https://crrev.com/0a353ab8c75241ef2e1101bcf5e2e23ae32a1fbf/third_party/WebKit/Source/core/css/view-source.css
,
Apr 6 2016
Re: comment #7: > "Elements > Edit as HTML" uses `4`. No, it uses whatever the source document is using (i.e. the `innerHTML`). The document you were testing it on must have used 4-space indents, but that’s not true for every HTML document on the web.
,
Apr 6 2016
Ah, good to know Mathias. Thanks for clarifying that. Just verified the fix is working in Version 51.0.2702.0. So it should be going out to Beta and Stable channels with M51.
,
Apr 6 2016
>> "Elements > Edit as HTML" uses `4`. > No, it uses whatever the source document is using (i.e. the `innerHTML`) For the record, I wasn’t talking about the indentation style in “Edit as HTML”. I only meant that when “Edit as HTML” editor view contains literal tabulation characters (U+0009), then each of those characters is rendered as having the same width as 4 space (U+0020) characters (whether that’s implemented using `tab-size:4` or not, I don’t know). |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by jonathan.garbee@chromium.org
, Mar 29 2016