| 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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 if (widget) | 799 if (widget) |
| 800 this._codeMirror.removeLineWidget(widget); | 800 this._codeMirror.removeLineWidget(widget); |
| 801 }, | 801 }, |
| 802 | 802 |
| 803 /** | 803 /** |
| 804 * @param {number} lineNumber | 804 * @param {number} lineNumber |
| 805 * @param {number=} columnNumber | 805 * @param {number=} columnNumber |
| 806 */ | 806 */ |
| 807 highlightPosition: function(lineNumber, columnNumber) | 807 highlightPosition: function(lineNumber, columnNumber) |
| 808 { | 808 { |
| 809 if (lineNumber < 0) | 809 lineNumber = Number.constrain(lineNumber, 0, this._codeMirror.lineCount(
) - 1); |
| 810 return; | 810 if (typeof columnNumber !== "number") |
| 811 lineNumber = Math.min(lineNumber, this._codeMirror.lineCount() - 1); | |
| 812 if (typeof columnNumber !== "number" || columnNumber < 0 || columnNumber
> this._codeMirror.getLine(lineNumber).length) | |
| 813 columnNumber = 0; | 811 columnNumber = 0; |
| 812 columnNumber = Number.constrain(columnNumber, 0, this._codeMirror.getLin
e(lineNumber).length); |
| 814 | 813 |
| 815 this.clearPositionHighlight(); | 814 this.clearPositionHighlight(); |
| 816 this._highlightedLine = this._codeMirror.getLineHandle(lineNumber); | 815 this._highlightedLine = this._codeMirror.getLineHandle(lineNumber); |
| 817 if (!this._highlightedLine) | 816 if (!this._highlightedLine) |
| 818 return; | 817 return; |
| 819 this.revealLine(lineNumber); | 818 this.revealLine(lineNumber); |
| 820 this._codeMirror.addLineClass(this._highlightedLine, null, "cm-highlight
"); | 819 this._codeMirror.addLineClass(this._highlightedLine, null, "cm-highlight
"); |
| 821 this._clearHighlightTimeout = setTimeout(this.clearPositionHighlight.bin
d(this), 2000); | 820 this._clearHighlightTimeout = setTimeout(this.clearPositionHighlight.bin
d(this), 2000); |
| 822 if (!this.readOnly()) | 821 if (!this.readOnly()) |
| 823 this.setSelection(WebInspector.TextRange.createFromLocation(lineNumb
er, columnNumber)); | 822 this.setSelection(WebInspector.TextRange.createFromLocation(lineNumb
er, columnNumber)); |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1710 function tokenOverride(superToken, stream, state) | 1709 function tokenOverride(superToken, stream, state) |
| 1711 { | 1710 { |
| 1712 var token = superToken(stream, state); | 1711 var token = superToken(stream, state); |
| 1713 return token ? tokenPrefix + token : token; | 1712 return token ? tokenPrefix + token : token; |
| 1714 } | 1713 } |
| 1715 } | 1714 } |
| 1716 | 1715 |
| 1717 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("css", "css-")
; | 1716 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("css", "css-")
; |
| 1718 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("javascript",
"js-"); | 1717 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("javascript",
"js-"); |
| 1719 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("xml", "xml-")
; | 1718 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("xml", "xml-")
; |
| OLD | NEW |