Bug 90172 - Web Inspector: Make the Tab character 4 spaces width
Summary: Web Inspector: Make the Tab character 4 spaces width
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-28 06:41 PDT by Nikita Vasilyev
Modified: 2012-07-10 09:11 PDT (History)
11 users (show)

See Also:


Attachments
Tab character width setting (4.54 KB, image/png)
2012-06-28 06:41 PDT, Nikita Vasilyev
no flags Details
WIP (4.80 KB, patch)
2012-07-02 16:07 PDT, Nikita Vasilyev
no flags Details | Formatted Diff | Diff
Sublime Text 2 indent settings (23.50 KB, image/png)
2012-07-04 07:13 PDT, Nikita Vasilyev
no flags Details
Make the Tab character 4 spaces width (1.07 KB, patch)
2012-07-10 07:31 PDT, Nikita Vasilyev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2012-06-28 06:41:45 PDT
Created attachment 149939 [details]
Tab character width setting

In source editor, tab character width is 8 characters long. Since WebKit supports tab-size CSS property (https://bugs.webkit.org/show_bug.cgi?id=52994), it would be nice to make tab character width configurable.
Comment 1 Pavel Feldman 2012-06-29 21:59:34 PDT
@Nikita, do you have a patch for this?
Comment 2 Nikita Vasilyev 2012-06-30 00:34:51 PDT
(In reply to comment #1)
> @Nikita, do you have a patch for this?

No, but I can make one if think it’s a valuable feature.
Comment 3 Pavel Feldman 2012-07-02 06:22:27 PDT
> No, but I can make one if think it’s a valuable feature.

I think it would be useful.
Comment 4 Nikita Vasilyev 2012-07-02 16:07:21 PDT
Created attachment 150494 [details]
WIP

I’m not sure about TextIndent class I introduced.
Comment 5 Pavel Feldman 2012-07-04 06:26:09 PDT
Comment on attachment 150494 [details]
WIP

View in context: https://bugs.webkit.org/attachment.cgi?id=150494&action=review

> Source/WebCore/inspector/front-end/SettingsScreen.js:282
> +    p.appendChild(this._createSelectSetting(WebInspector.UIString("Indent size"), [

Indentation size and tab size can have different values. Indentation size is a "model" property, it affects the file being saved on disk. Tab size is "view" property, it only affects visual representation. I'd suggest that you add a selector for the tab size and use it in the TextEditor.js only. The model part of the code should stay the same.

> Source/WebCore/inspector/front-end/TextEditorModel.js:493
> +function TextIndent()

I don't think you need this, but if you did, you would need to format it as:

/**
 * @constructor
 */
WebInspector.TextEditorModel.Indent = function()
{
}

...
Comment 6 Nikita Vasilyev 2012-07-04 07:13:27 PDT
Created attachment 150790 [details]
Sublime Text 2 indent settings

(In reply to comment #5)
> (From update of attachment 150494 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=150494&action=review
> 
> > Source/WebCore/inspector/front-end/SettingsScreen.js:282
> > +    p.appendChild(this._createSelectSetting(WebInspector.UIString("Indent size"), [
> 
> Indentation size and tab size can have different values. Indentation size is a "model" property, it affects the file being saved on disk. Tab size is "view" property, it only affects visual representation. I'd suggest that you add a selector for the tab size and use it in the TextEditor.js only. The model part of the code should stay the same.

Why would someone want a tab size different from an indentation size? I’ve attached a screenshot of indentation settings in Sublime Text 2; it doesn’t distinguish indentation size and tab size.
Comment 7 Pavel Feldman 2012-07-04 07:54:56 PDT
> Why would someone want a tab size different from an indentation size? I’ve attached a screenshot of indentation settings in Sublime Text 2; it doesn’t distinguish indentation size and tab size.

Well, all the other editors I know distinguish between the two and it makes sense to me. As I explained above, one is about model and another is about view. Imagine the code guidelines where indentation is done using 4 spaces, while tab character is still allowed and should be 8 characters long. Or indentation is two tabs.
Comment 8 Nikita Vasilyev 2012-07-05 07:57:34 PDT
(In reply to comment #7)
> > Why would someone want a tab size different from an indentation size? I’ve attached a screenshot of indentation settings in Sublime Text 2; it doesn’t distinguish indentation size and tab size.
> 
> Well, all the other editors I know distinguish between the two and it makes sense to me. As I explained above, one is about model and another is about view. Imagine the code guidelines where indentation is done using 4 spaces, while tab character is still allowed and should be 8 characters long. Or indentation is two tabs.

I see IDEs such as Xcode and IntelliJ IDEA do distinguish the two. Many lightweight code editors such as Chocolat.app and Textmate don’t.

Personally, I just want to make a tab character 4 spaces width. It’s a default tab width in all the editors I’ve mentioned above.
Comment 9 Nikita Vasilyev 2012-07-10 07:31:33 PDT
Created attachment 151459 [details]
Make the Tab character 4 spaces width

I suggest to make this small change for now. If someone actually want to configure the Tab size, we’ll see the bug filled.
Comment 10 WebKit Review Bot 2012-07-10 09:11:25 PDT
Comment on attachment 151459 [details]
Make the Tab character 4 spaces width

Clearing flags on attachment: 151459

Committed r122227: <http://trac.webkit.org/changeset/122227>
Comment 11 WebKit Review Bot 2012-07-10 09:11:30 PDT
All reviewed patches have been landed.  Closing bug.