| 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 */ |
| 11 constructor(delegate) { | 11 constructor(delegate) { |
| 12 super({ | 12 super({ |
| 13 lineNumbers: true, | 13 lineNumbers: true, |
| 14 lineWrapping: false, | 14 lineWrapping: false, |
| 15 bracketMatchingSetting: Common.moduleSetting('textEditorBracketMatching'), | 15 bracketMatchingSetting: Common.moduleSetting('textEditorBracketMatching'), |
| 16 padBottom: true |
| 16 }); | 17 }); |
| 17 | 18 |
| 18 this.codeMirror().addKeyMap({'Enter': 'smartNewlineAndIndent', 'Esc': 'sourc
esDismiss'}); | 19 this.codeMirror().addKeyMap({'Enter': 'smartNewlineAndIndent', 'Esc': 'sourc
esDismiss'}); |
| 19 | 20 |
| 20 this._delegate = delegate; | 21 this._delegate = delegate; |
| 21 | 22 |
| 22 this.codeMirror().on('changes', this._fireTextChanged.bind(this)); | 23 this.codeMirror().on('changes', this._fireTextChanged.bind(this)); |
| 23 this.codeMirror().on('cursorActivity', this._cursorActivity.bind(this)); | 24 this.codeMirror().on('cursorActivity', this._cursorActivity.bind(this)); |
| 24 this.codeMirror().on('gutterClick', this._gutterClick.bind(this)); | 25 this.codeMirror().on('gutterClick', this._gutterClick.bind(this)); |
| 25 this.codeMirror().on('scroll', this._scroll.bind(this)); | 26 this.codeMirror().on('scroll', this._scroll.bind(this)); |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 */ | 871 */ |
| 871 _setHighlighter(highlighter, selectionStart) { | 872 _setHighlighter(highlighter, selectionStart) { |
| 872 var overlayMode = {token: highlighter}; | 873 var overlayMode = {token: highlighter}; |
| 873 this._codeMirror.addOverlay(overlayMode); | 874 this._codeMirror.addOverlay(overlayMode); |
| 874 this._highlightDescriptor = {overlay: overlayMode, selectionStart: selection
Start}; | 875 this._highlightDescriptor = {overlay: overlayMode, selectionStart: selection
Start}; |
| 875 } | 876 } |
| 876 }; | 877 }; |
| 877 | 878 |
| 878 SourceFrame.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; | 879 SourceFrame.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; |
| 879 SourceFrame.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; | 880 SourceFrame.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; |
| OLD | NEW |