OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 return null; | 619 return null; |
620 var gutterBox = this._codeMirror.getGutterElement().boxInWindow(); | 620 var gutterBox = this._codeMirror.getGutterElement().boxInWindow(); |
621 if (x >= gutterBox.x && x <= gutterBox.x + gutterBox.width && y >= gutterBox
.y && | 621 if (x >= gutterBox.x && x <= gutterBox.x + gutterBox.width && y >= gutterBox
.y && |
622 y <= gutterBox.y + gutterBox.height) | 622 y <= gutterBox.y + gutterBox.height) |
623 return null; | 623 return null; |
624 var coords = this._codeMirror.coordsChar({left: x, top: y}); | 624 var coords = this._codeMirror.coordsChar({left: x, top: y}); |
625 return TextEditor.CodeMirrorUtils.toRange(coords, coords); | 625 return TextEditor.CodeMirrorUtils.toRange(coords, coords); |
626 } | 626 } |
627 | 627 |
628 /** | 628 /** |
| 629 * @override |
629 * @param {number} lineNumber | 630 * @param {number} lineNumber |
630 * @param {number} column | 631 * @param {number} columnNumber |
631 * @return {?{startColumn: number, endColumn: number, type: string}} | 632 * @return {?{startColumn: number, endColumn: number, type: string}} |
632 */ | 633 */ |
633 tokenAtTextPosition(lineNumber, column) { | 634 tokenAtTextPosition(lineNumber, columnNumber) { |
634 if (lineNumber < 0 || lineNumber >= this._codeMirror.lineCount()) | 635 if (lineNumber < 0 || lineNumber >= this._codeMirror.lineCount()) |
635 return null; | 636 return null; |
636 var token = this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber, (colu
mn || 0) + 1)); | 637 var token = this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber, (colu
mnNumber || 0) + 1)); |
637 if (!token) | 638 if (!token) |
638 return null; | 639 return null; |
639 return {startColumn: token.start, endColumn: token.end, type: token.type}; | 640 return {startColumn: token.start, endColumn: token.end, type: token.type}; |
640 } | 641 } |
641 | 642 |
642 /** | 643 /** |
643 * @return {boolean} | 644 * @return {boolean} |
644 */ | 645 */ |
645 isClean() { | 646 isClean() { |
646 return this._codeMirror.isClean(); | 647 return this._codeMirror.isClean(); |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 TextEditor.CodeMirrorTextEditorFactory = class { | 1631 TextEditor.CodeMirrorTextEditorFactory = class { |
1631 /** | 1632 /** |
1632 * @override | 1633 * @override |
1633 * @param {!UI.TextEditor.Options} options | 1634 * @param {!UI.TextEditor.Options} options |
1634 * @return {!TextEditor.CodeMirrorTextEditor} | 1635 * @return {!TextEditor.CodeMirrorTextEditor} |
1635 */ | 1636 */ |
1636 createEditor(options) { | 1637 createEditor(options) { |
1637 return new TextEditor.CodeMirrorTextEditor(options); | 1638 return new TextEditor.CodeMirrorTextEditor(options); |
1638 } | 1639 } |
1639 }; | 1640 }; |
OLD | NEW |