Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.CodeMirrorTextEditor} | 7 * @extends {WebInspector.CodeMirrorTextEditor} |
| 8 * @param {!WebInspector.SourcesTextEditorDelegate} delegate | 8 * @param {!WebInspector.SourcesTextEditorDelegate} delegate |
| 9 */ | 9 */ |
| 10 WebInspector.SourcesTextEditor = function(delegate) | 10 WebInspector.SourcesTextEditor = function(delegate) |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 { | 167 { |
| 168 if (this._gutters.indexOf(type) !== -1) | 168 if (this._gutters.indexOf(type) !== -1) |
| 169 return; | 169 return; |
| 170 | 170 |
| 171 if (leftToNumbers) | 171 if (leftToNumbers) |
| 172 this._gutters.unshift(type); | 172 this._gutters.unshift(type); |
| 173 else | 173 else |
| 174 this._gutters.push(type); | 174 this._gutters.push(type); |
| 175 | 175 |
| 176 this.codeMirror().setOption("gutters", this._gutters.slice()); | 176 this.codeMirror().setOption("gutters", this._gutters.slice()); |
| 177 this.codeMirror().refresh(); | 177 this.refresh(); |
| 178 }, | 178 }, |
| 179 | 179 |
| 180 /** | 180 /** |
| 181 * @param {string} type | 181 * @param {string} type |
| 182 */ | 182 */ |
| 183 uninstallGutter: function(type) | 183 uninstallGutter: function(type) |
| 184 { | 184 { |
| 185 var originalLength = this._gutters.length; | |
|
lushnikov
2016/09/14 19:02:35
indexOf..
| |
| 185 this._gutters = this._gutters.filter(gutter => gutter !== type); | 186 this._gutters = this._gutters.filter(gutter => gutter !== type); |
| 187 if (originalLength === this._gutters.length) | |
| 188 return; | |
| 186 this.codeMirror().setOption("gutters", this._gutters.slice()); | 189 this.codeMirror().setOption("gutters", this._gutters.slice()); |
| 187 this.codeMirror().refresh(); | 190 this.refresh(); |
| 188 }, | 191 }, |
| 189 | 192 |
| 190 /** | 193 /** |
| 191 * @param {number} lineNumber | 194 * @param {number} lineNumber |
| 192 * @param {string} type | 195 * @param {string} type |
| 193 * @param {?Element} element | 196 * @param {?Element} element |
| 194 */ | 197 */ |
| 195 setGutterDecoration: function(lineNumber, type, element) | 198 setGutterDecoration: function(lineNumber, type, element) |
| 196 { | 199 { |
| 197 console.assert(this._gutters.indexOf(type) !== -1, "Cannot decorate unex isting gutter.") | 200 console.assert(this._gutters.indexOf(type) !== -1, "Cannot decorate unex isting gutter.") |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 985 this._codeMirror.addOverlay(overlayMode); | 988 this._codeMirror.addOverlay(overlayMode); |
| 986 this._highlightDescriptor = { | 989 this._highlightDescriptor = { |
| 987 overlay: overlayMode, | 990 overlay: overlayMode, |
| 988 selectionStart: selectionStart | 991 selectionStart: selectionStart |
| 989 }; | 992 }; |
| 990 } | 993 } |
| 991 } | 994 } |
| 992 | 995 |
| 993 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; | 996 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; |
| 994 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; | 997 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; |
| OLD | NEW |