Changeset 54415 in webkit
- Timestamp:
- Feb 5, 2010 2:50:42 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r54413 r54415 1 2010-02-05 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: Tab width for javascript source is 8, should be 4 6 7 https://bugs.webkit.org/show_bug.cgi?id=31248 8 9 * inspector/front-end/SourceFrame.js: 10 (WebInspector.SourceFrame): 11 * inspector/front-end/TextEditorModel.js: 12 (WebInspector.TextEditorModel.prototype.set replaceTabsWithSpaces): 13 (WebInspector.TextEditorModel.prototype._innerSetText): 14 (WebInspector.TextEditorModel.prototype._replaceTabsIfNeeded): 15 1 16 2010-02-05 Tony Chang <tony@chromium.org> 2 17 -
trunk/WebCore/inspector/front-end/SourceFrame.js
r54231 r54415 34 34 35 35 this._textModel = new WebInspector.TextEditorModel(); 36 this._textModel.replaceTabsWithSpaces = true; 36 37 37 38 this._messages = []; -
trunk/WebCore/inspector/front-end/TextEditorModel.js
r54052 r54415 98 98 }, 99 99 100 set replaceTabsWithSpaces(replaceTabsWithSpaces) 101 { 102 this._replaceTabsWithSpaces = replaceTabsWithSpaces; 103 }, 104 100 105 _innerSetText: function(range, text) 101 106 { … … 105 110 106 111 var newLines = text.split("\n"); 112 this._replaceTabsIfNeeded(newLines); 113 107 114 var prefix = this._lines[range.startLine].substring(0, range.startColumn); 108 115 var prefixArguments = this._arguments … … 123 130 return new WebInspector.TextRange(range.startLine, range.startColumn, 124 131 range.startLine + newLines.length - 1, postCaret); 132 }, 133 134 _replaceTabsIfNeeded: function(lines) 135 { 136 if (!this._replaceTabsWithSpaces) 137 return; 138 var spaces = [ " ", " ", " ", " "]; 139 for (var i = 0; i < lines.length; ++i) { 140 var line = lines[i]; 141 var index = line.indexOf("\t"); 142 while (index !== -1) { 143 line = line.substring(0, index) + spaces[index % 4] + line.substring(index + 1); 144 index = line.indexOf("\t", index + 1); 145 } 146 lines[i] = line; 147 } 125 148 }, 126 149
Note: See TracChangeset
for help on using the changeset viewer.