| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 this.codeMirror().on("changes", this._fireTextChanged.bind(this)); | 25 this.codeMirror().on("changes", this._fireTextChanged.bind(this)); |
| 26 this.codeMirror().on("cursorActivity", this._cursorActivity.bind(this)); | 26 this.codeMirror().on("cursorActivity", this._cursorActivity.bind(this)); |
| 27 this.codeMirror().on("gutterClick", this._gutterClick.bind(this)); | 27 this.codeMirror().on("gutterClick", this._gutterClick.bind(this)); |
| 28 this.codeMirror().on("scroll", this._scroll.bind(this)); | 28 this.codeMirror().on("scroll", this._scroll.bind(this)); |
| 29 this.codeMirror().on("focus", this._focus.bind(this)); | 29 this.codeMirror().on("focus", this._focus.bind(this)); |
| 30 this.codeMirror().on("blur", this._blur.bind(this)); | 30 this.codeMirror().on("blur", this._blur.bind(this)); |
| 31 this.codeMirror().on("beforeSelectionChange", this._fireBeforeSelectionChang
ed.bind(this)); | 31 this.codeMirror().on("beforeSelectionChange", this._fireBeforeSelectionChang
ed.bind(this)); |
| 32 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f
alse); | 32 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f
alse); |
| 33 | 33 |
| 34 this._blockIndentController = new WebInspector.SourcesTextEditor.BlockIndent
Controller(this.codeMirror()); | 34 this.codeMirror().addKeyMap(WebInspector.SourcesTextEditor._BlockIndentContr
oller); |
| 35 this._tokenHighlighter = new WebInspector.SourcesTextEditor.TokenHighlighter
(this, this.codeMirror()); | 35 this._tokenHighlighter = new WebInspector.SourcesTextEditor.TokenHighlighter
(this, this.codeMirror()); |
| 36 | 36 |
| 37 /** @type {!Array<string>} */ | 37 /** @type {!Array<string>} */ |
| 38 this._gutters = ["CodeMirror-linenumbers"]; | 38 this._gutters = ["CodeMirror-linenumbers"]; |
| 39 this.codeMirror().setOption("gutters", this._gutters.slice()); | 39 this.codeMirror().setOption("gutters", this._gutters.slice()); |
| 40 | 40 |
| 41 this.codeMirror().setOption("electricChars", false); | 41 this.codeMirror().setOption("electricChars", false); |
| 42 this.codeMirror().setOption("smartIndent", false); | 42 this.codeMirror().setOption("smartIndent", false); |
| 43 | 43 |
| 44 /** | 44 /** |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 /** | 677 /** |
| 678 * @return {!Object|undefined} | 678 * @return {!Object|undefined} |
| 679 */ | 679 */ |
| 680 CodeMirror.commands.sourcesDismiss = function(codemirror) | 680 CodeMirror.commands.sourcesDismiss = function(codemirror) |
| 681 { | 681 { |
| 682 if (codemirror.listSelections().length === 1 && codemirror._codeMirrorTextEd
itor._isSearchActive()) | 682 if (codemirror.listSelections().length === 1 && codemirror._codeMirrorTextEd
itor._isSearchActive()) |
| 683 return CodeMirror.Pass; | 683 return CodeMirror.Pass; |
| 684 return CodeMirror.commands.dismiss(codemirror); | 684 return CodeMirror.commands.dismiss(codemirror); |
| 685 }; | 685 }; |
| 686 | 686 |
| 687 /** | 687 WebInspector.SourcesTextEditor._BlockIndentController = { |
| 688 * @constructor | |
| 689 * @param {!CodeMirror} codeMirror | |
| 690 */ | |
| 691 WebInspector.SourcesTextEditor.BlockIndentController = function(codeMirror) | |
| 692 { | |
| 693 codeMirror.addKeyMap(this); | |
| 694 }; | |
| 695 | |
| 696 WebInspector.SourcesTextEditor.BlockIndentController.prototype = { | |
| 697 name: "blockIndentKeymap", | 688 name: "blockIndentKeymap", |
| 698 | 689 |
| 699 /** | 690 /** |
| 700 * @return {*} | 691 * @return {*} |
| 701 */ | 692 */ |
| 702 Enter: function(codeMirror) | 693 Enter: function(codeMirror) |
| 703 { | 694 { |
| 704 var selections = codeMirror.listSelections(); | 695 var selections = codeMirror.listSelections(); |
| 705 var replacements = []; | 696 var replacements = []; |
| 706 var allSelectionsAreCollapsedBlocks = false; | 697 var allSelectionsAreCollapsedBlocks = false; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 this._codeMirror.addOverlay(overlayMode); | 971 this._codeMirror.addOverlay(overlayMode); |
| 981 this._highlightDescriptor = { | 972 this._highlightDescriptor = { |
| 982 overlay: overlayMode, | 973 overlay: overlayMode, |
| 983 selectionStart: selectionStart | 974 selectionStart: selectionStart |
| 984 }; | 975 }; |
| 985 } | 976 } |
| 986 }; | 977 }; |
| 987 | 978 |
| 988 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; | 979 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; |
| 989 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; | 980 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; |
| OLD | NEW |