| 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 WebInspector.SourcesTextEditor = class extends WebInspector.CodeMirrorTextEditor
{ | 7 WebInspector.SourcesTextEditor = class extends WebInspector.CodeMirrorTextEditor
{ |
| 8 /** | 8 /** |
| 9 * @param {!WebInspector.SourcesTextEditorDelegate} delegate | 9 * @param {!WebInspector.SourcesTextEditorDelegate} delegate |
| 10 */ | 10 */ |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 this._searchResultMarker.clear(); | 788 this._searchResultMarker.clear(); |
| 789 delete this._searchResultMarker; | 789 delete this._searchResultMarker; |
| 790 } | 790 } |
| 791 if (this._highlightDescriptor && this._highlightDescriptor.selectionStart) | 791 if (this._highlightDescriptor && this._highlightDescriptor.selectionStart) |
| 792 this._codeMirror.removeLineClass(this._highlightDescriptor.selectionStart.
line, 'wrap', 'cm-line-with-selection'); | 792 this._codeMirror.removeLineClass(this._highlightDescriptor.selectionStart.
line, 'wrap', 'cm-line-with-selection'); |
| 793 var selectionStart = this._highlightRange ? | 793 var selectionStart = this._highlightRange ? |
| 794 new CodeMirror.Pos(this._highlightRange.startLine, this._highlightRange.
startColumn) : | 794 new CodeMirror.Pos(this._highlightRange.startLine, this._highlightRange.
startColumn) : |
| 795 null; | 795 null; |
| 796 if (selectionStart) | 796 if (selectionStart) |
| 797 this._codeMirror.addLineClass(selectionStart.line, 'wrap', 'cm-line-with-s
election'); | 797 this._codeMirror.addLineClass(selectionStart.line, 'wrap', 'cm-line-with-s
election'); |
| 798 if (this._highlightRegex === oldRegex) { | 798 if (oldRegex && this._highlightRegex.toString() === oldRegex.toString()) { |
| 799 // Do not re-add overlay mode if regex did not change for better performan
ce. | 799 // Do not re-add overlay mode if regex did not change for better performan
ce. |
| 800 if (this._highlightDescriptor) | 800 if (this._highlightDescriptor) |
| 801 this._highlightDescriptor.selectionStart = selectionStart; | 801 this._highlightDescriptor.selectionStart = selectionStart; |
| 802 } else { | 802 } else { |
| 803 this._removeHighlight(); | 803 this._removeHighlight(); |
| 804 this._setHighlighter(this._searchHighlighter.bind(this, this._highlightReg
ex), selectionStart); | 804 this._setHighlighter(this._searchHighlighter.bind(this, this._highlightReg
ex), selectionStart); |
| 805 } | 805 } |
| 806 if (this._highlightRange) { | 806 if (this._highlightRange) { |
| 807 var pos = WebInspector.CodeMirrorUtils.toPos(this._highlightRange); | 807 var pos = WebInspector.CodeMirrorUtils.toPos(this._highlightRange); |
| 808 this._searchResultMarker = this._codeMirror.markText(pos.start, pos.end, {
className: 'cm-column-with-selection'}); | 808 this._searchResultMarker = this._codeMirror.markText(pos.start, pos.end, {
className: 'cm-column-with-selection'}); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 */ | 912 */ |
| 913 _setHighlighter(highlighter, selectionStart) { | 913 _setHighlighter(highlighter, selectionStart) { |
| 914 var overlayMode = {token: highlighter}; | 914 var overlayMode = {token: highlighter}; |
| 915 this._codeMirror.addOverlay(overlayMode); | 915 this._codeMirror.addOverlay(overlayMode); |
| 916 this._highlightDescriptor = {overlay: overlayMode, selectionStart: selection
Start}; | 916 this._highlightDescriptor = {overlay: overlayMode, selectionStart: selection
Start}; |
| 917 } | 917 } |
| 918 }; | 918 }; |
| 919 | 919 |
| 920 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; | 920 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; |
| 921 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; | 921 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; |
| OLD | NEW |