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

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

Issue 472793002: DevTools: Make TextEditor.tokenAtTextPosition() return exclusive end column (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix remaining cases Created 6 years, 4 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
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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 */ 727 */
728 tokenAtTextPosition: function(lineNumber, column) 728 tokenAtTextPosition: function(lineNumber, column)
729 { 729 {
730 if (lineNumber < 0 || lineNumber >= this._codeMirror.lineCount()) 730 if (lineNumber < 0 || lineNumber >= this._codeMirror.lineCount())
731 return null; 731 return null;
732 var token = this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber, ( column || 0) + 1)); 732 var token = this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber, ( column || 0) + 1));
733 if (!token || !token.type) 733 if (!token || !token.type)
734 return null; 734 return null;
735 return { 735 return {
736 startColumn: token.start, 736 startColumn: token.start,
737 endColumn: token.end - 1, 737 endColumn: token.end,
738 type: token.type 738 type: token.type
739 }; 739 };
740 }, 740 },
741 741
742 /** 742 /**
743 * @param {!WebInspector.TextRange} textRange 743 * @param {!WebInspector.TextRange} textRange
744 * @return {string} 744 * @return {string}
745 */ 745 */
746 copyRange: function(textRange) 746 copyRange: function(textRange)
747 { 747 {
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2406 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte d { background-color: " + backgroundColor + ";}" : ""; 2406 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte d { background-color: " + backgroundColor + ";}" : "";
2407 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); 2407 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor();
2408 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import ant;}" : ""; 2408 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import ant;}" : "";
2409 if (!foregroundColorRule && !backgroundColorRule) 2409 if (!foregroundColorRule && !backgroundColorRule)
2410 return; 2410 return;
2411 2411
2412 var style = document.createElement("style"); 2412 var style = document.createElement("style");
2413 style.textContent = backgroundColorRule + foregroundColorRule; 2413 style.textContent = backgroundColorRule + foregroundColorRule;
2414 document.head.appendChild(style); 2414 document.head.appendChild(style);
2415 })(); 2415 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698