Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js

Issue 2281703002: DevTools: Create TextEditor Interface around CodeMirrorTextEditor (Closed)
Patch Set: Remove accidental devtools.gypi Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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)
11 { 11 {
12 WebInspector.CodeMirrorTextEditor.call(this); 12 WebInspector.CodeMirrorTextEditor.call(this, {
13 lineNumbers: true,
14 lineWrapping: false,
15 bracketMatchingSetting: WebInspector.moduleSetting("textEditorBracketMat ching"),
16 });
13 17
14 this.codeMirror().addKeyMap({ 18 this.codeMirror().addKeyMap({
15 "Enter": "smartNewlineAndIndent", 19 "Enter": "smartNewlineAndIndent",
16 "Esc": "sourcesDismiss" 20 "Esc": "sourcesDismiss"
17 }); 21 });
18 22
19 this._delegate = delegate; 23 this._delegate = delegate;
20 24
21 this.codeMirror().on("changes", this._changesForDelegate.bind(this)); 25 this.codeMirror().on("changes", this._changesForDelegate.bind(this));
22 this.codeMirror().on("cursorActivity", this._cursorActivity.bind(this)); 26 this.codeMirror().on("cursorActivity", this._cursorActivity.bind(this));
23 this.codeMirror().on("gutterClick", this._gutterClick.bind(this)); 27 this.codeMirror().on("gutterClick", this._gutterClick.bind(this));
24 this.codeMirror().on("scroll", this._scroll.bind(this)); 28 this.codeMirror().on("scroll", this._scroll.bind(this));
25 this.codeMirror().on("focus", this._focus.bind(this)); 29 this.codeMirror().on("focus", this._focus.bind(this));
26 this.codeMirror().on("beforeSelectionChange", this._beforeSelectionChangeFor Delegate.bind(this)); 30 this.codeMirror().on("beforeSelectionChange", this._beforeSelectionChangeFor Delegate.bind(this));
27 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse); 31 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse);
28 32
29 this._blockIndentController = new WebInspector.SourcesTextEditor.BlockIndent Controller(this.codeMirror()); 33 this._blockIndentController = new WebInspector.SourcesTextEditor.BlockIndent Controller(this.codeMirror());
30 this._tokenHighlighter = new WebInspector.SourcesTextEditor.TokenHighlighter (this, this.codeMirror()); 34 this._tokenHighlighter = new WebInspector.SourcesTextEditor.TokenHighlighter (this, this.codeMirror());
31 35
32 /** @type {!Array<string>} */ 36 /** @type {!Array<string>} */
33 this._gutters = ["CodeMirror-linenumbers"]; 37 this._gutters = ["CodeMirror-linenumbers"];
38 this.codeMirror().setOption("gutters", this._gutters.slice());
34 39
35 /** 40 /**
36 * @this {WebInspector.SourcesTextEditor} 41 * @this {WebInspector.SourcesTextEditor}
37 */ 42 */
38 function updateAnticipateJumpFlag(value) 43 function updateAnticipateJumpFlag(value)
39 { 44 {
40 this._isHandlingMouseDownEvent = value; 45 this._isHandlingMouseDownEvent = value;
41 } 46 }
42 47
43 this.element.addEventListener("mousedown", updateAnticipateJumpFlag.bind(thi s, true), true); 48 this.element.addEventListener("mousedown", updateAnticipateJumpFlag.bind(thi s, true), true);
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 this._codeMirror.addOverlay(overlayMode); 977 this._codeMirror.addOverlay(overlayMode);
973 this._highlightDescriptor = { 978 this._highlightDescriptor = {
974 overlay: overlayMode, 979 overlay: overlayMode,
975 selectionStart: selectionStart 980 selectionStart: selectionStart
976 }; 981 };
977 } 982 }
978 } 983 }
979 984
980 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; 985 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000;
981 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; 986 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698