[Webkit-unassigned] [Bug 31248] Tab width for javascript source is 8, should be 4

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 4 22:19:59 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=31248





--- Comment #12 from Patrick Mueller <pmuellr at yahoo.com>  2010-02-04 22:19:57 PST ---
The patch is doing a blind replacement of \t with 4 space characters; but
that's not how tabs actually work; they add a variable # of spaces to get the
following characters to align on the tab-width boundaries.

For example, if the original text looks is this, where - is the tab character

----------------
-a-b-c
 -d -e -f
----------------

then the text will be displayed like this:

----------------
    a   b   c
    d   e   f
----------------

The following original text, again, with - as the tab character, yields the
same display as above; note there is a space before each tab character:

----------------
-a-b-c
 -d -e -f
----------------

However, if we use the "\t == 4 spaces" replacement, the expanded text becomes
this:

----------------
    a    b    c
     d     e     f
----------------

In practice, if people consistently use tabs just at the beginnings of lines,
and never accidently inject spaces, then the expansion will work fine.  In my
practice, when I used to use tabs in source files, I found that I frequently
accidently mixed spaces with tabs; everything LOOKED ok in the editor.  But
using the "\t == 4" spaces replacement would have ended up with the unaligned
output as above.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list