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

Side by Side Diff: Source/devtools/front_end/CodeMirrorTextEditor.js

Issue 131033004: DevTools: introduce goto-column functionality (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed spaces Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/devtools/front_end/FilteredItemSelectionDialog.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 if (widget) 798 if (widget)
799 this._codeMirror.removeLineWidget(widget); 799 this._codeMirror.removeLineWidget(widget);
800 }, 800 },
801 801
802 /** 802 /**
803 * @param {number} lineNumber 803 * @param {number} lineNumber
804 * @param {number=} columnNumber 804 * @param {number=} columnNumber
805 */ 805 */
806 highlightPosition: function(lineNumber, columnNumber) 806 highlightPosition: function(lineNumber, columnNumber)
807 { 807 {
808 if (lineNumber < 0) 808 lineNumber = Number.constrain(lineNumber, 0, this._codeMirror.lineCount( ) - 1);
809 return; 809 if (typeof columnNumber !== "number")
810 lineNumber = Math.min(lineNumber, this._codeMirror.lineCount() - 1);
811 if (typeof columnNumber !== "number" || columnNumber < 0 || columnNumber > this._codeMirror.getLine(lineNumber).length)
812 columnNumber = 0; 810 columnNumber = 0;
811 columnNumber = Number.constrain(columnNumber, 0, this._codeMirror.getLin e(lineNumber).length);
813 812
814 this.clearPositionHighlight(); 813 this.clearPositionHighlight();
815 this._highlightedLine = this._codeMirror.getLineHandle(lineNumber); 814 this._highlightedLine = this._codeMirror.getLineHandle(lineNumber);
816 if (!this._highlightedLine) 815 if (!this._highlightedLine)
817 return; 816 return;
818 this.revealLine(lineNumber); 817 this.revealLine(lineNumber);
819 this._codeMirror.addLineClass(this._highlightedLine, null, "cm-highlight "); 818 this._codeMirror.addLineClass(this._highlightedLine, null, "cm-highlight ");
820 this._clearHighlightTimeout = setTimeout(this.clearPositionHighlight.bin d(this), 2000); 819 this._clearHighlightTimeout = setTimeout(this.clearPositionHighlight.bin d(this), 2000);
821 if (!this.readOnly()) 820 if (!this.readOnly())
822 this.setSelection(WebInspector.TextRange.createFromLocation(lineNumb er, columnNumber)); 821 this.setSelection(WebInspector.TextRange.createFromLocation(lineNumb er, columnNumber));
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 function tokenOverride(superToken, stream, state) 1708 function tokenOverride(superToken, stream, state)
1710 { 1709 {
1711 var token = superToken(stream, state); 1710 var token = superToken(stream, state);
1712 return token ? tokenPrefix + token : token; 1711 return token ? tokenPrefix + token : token;
1713 } 1712 }
1714 } 1713 }
1715 1714
1716 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("css", "css-") ; 1715 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("css", "css-") ;
1717 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("javascript", "js-"); 1716 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("javascript", "js-");
1718 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("xml", "xml-") ; 1717 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("xml", "xml-") ;
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/FilteredItemSelectionDialog.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698