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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 SourceFrame.SourcesTextEditor = class extends TextEditor.CodeMirrorTextEditor { | 7 SourceFrame.SourcesTextEditor = class extends TextEditor.CodeMirrorTextEditor { |
| 8 /** | 8 /** |
| 9 * @param {!SourceFrame.SourcesTextEditorDelegate} delegate | 9 * @param {!SourceFrame.SourcesTextEditorDelegate} delegate |
| 10 */ | 10 */ |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 */ | 158 */ |
| 159 highlightRange(range, cssClass) { | 159 highlightRange(range, cssClass) { |
| 160 cssClass = 'CodeMirror-persist-highlight ' + cssClass; | 160 cssClass = 'CodeMirror-persist-highlight ' + cssClass; |
| 161 var pos = TextEditor.CodeMirrorUtils.toPos(range); | 161 var pos = TextEditor.CodeMirrorUtils.toPos(range); |
| 162 ++pos.end.ch; | 162 ++pos.end.ch; |
| 163 return this.codeMirror().markText( | 163 return this.codeMirror().markText( |
| 164 pos.start, pos.end, {className: cssClass, startStyle: cssClass + '-start ', endStyle: cssClass + '-end'}); | 164 pos.start, pos.end, {className: cssClass, startStyle: cssClass + '-start ', endStyle: cssClass + '-end'}); |
| 165 } | 165 } |
| 166 | 166 |
| 167 /** | 167 /** |
| 168 * @param {number} lineNumber | |
| 169 * @param {boolean} disabled | |
| 170 * @param {boolean} conditional | |
| 171 */ | |
| 172 addBreakpoint(lineNumber, disabled, conditional) { | |
|
lushnikov
2016/11/17 04:31:50
nice to get rid of these! thanks
| |
| 173 if (lineNumber < 0 || lineNumber >= this.codeMirror().lineCount()) | |
| 174 return; | |
| 175 | |
| 176 var className = 'cm-breakpoint' + (conditional ? ' cm-breakpoint-conditional ' : '') + | |
| 177 (disabled ? ' cm-breakpoint-disabled' : ''); | |
| 178 this.codeMirror().addLineClass(lineNumber, 'wrap', className); | |
| 179 } | |
| 180 | |
| 181 /** | |
| 182 * @param {number} lineNumber | |
| 183 */ | |
| 184 removeBreakpoint(lineNumber) { | |
| 185 if (lineNumber < 0 || lineNumber >= this.codeMirror().lineCount()) | |
| 186 return; | |
| 187 | |
| 188 var wrapClasses = this.codeMirror().getLineHandle(lineNumber).wrapClass; | |
| 189 if (!wrapClasses) | |
| 190 return; | |
| 191 | |
| 192 var classes = wrapClasses.split(' '); | |
| 193 for (var i = 0; i < classes.length; ++i) { | |
| 194 if (classes[i].startsWith('cm-breakpoint')) | |
| 195 this.codeMirror().removeLineClass(lineNumber, 'wrap', classes[i]); | |
| 196 } | |
| 197 } | |
| 198 | |
| 199 /** | |
| 200 * @param {string} type | 168 * @param {string} type |
| 201 * @param {boolean} leftToNumbers | 169 * @param {boolean} leftToNumbers |
| 202 */ | 170 */ |
| 203 installGutter(type, leftToNumbers) { | 171 installGutter(type, leftToNumbers) { |
| 204 if (this._gutters.indexOf(type) !== -1) | 172 if (this._gutters.indexOf(type) !== -1) |
| 205 return; | 173 return; |
| 206 | 174 |
| 207 if (leftToNumbers) | 175 if (leftToNumbers) |
| 208 this._gutters.unshift(type); | 176 this._gutters.unshift(type); |
| 209 else | 177 else |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 913 */ | 881 */ |
| 914 _setHighlighter(highlighter, selectionStart) { | 882 _setHighlighter(highlighter, selectionStart) { |
| 915 var overlayMode = {token: highlighter}; | 883 var overlayMode = {token: highlighter}; |
| 916 this._codeMirror.addOverlay(overlayMode); | 884 this._codeMirror.addOverlay(overlayMode); |
| 917 this._highlightDescriptor = {overlay: overlayMode, selectionStart: selection Start}; | 885 this._highlightDescriptor = {overlay: overlayMode, selectionStart: selection Start}; |
| 918 } | 886 } |
| 919 }; | 887 }; |
| 920 | 888 |
| 921 SourceFrame.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; | 889 SourceFrame.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; |
| 922 SourceFrame.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; | 890 SourceFrame.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; |
| OLD | NEW |