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

Unified Diff: Source/devtools/front_end/CodeMirrorTextEditor.js

Issue 220203007: DevTools: fix primary selection in multiple selections created with ctrl-d (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/CodeMirrorTextEditor.js
diff --git a/Source/devtools/front_end/CodeMirrorTextEditor.js b/Source/devtools/front_end/CodeMirrorTextEditor.js
index 0880f08fc9c08eefd2b92f4b3a36b5bcb3ccd7ee..a241bd16580844d3471e11bbae3c3a6577720045 100644
--- a/Source/devtools/front_end/CodeMirrorTextEditor.js
+++ b/Source/devtools/front_end/CodeMirrorTextEditor.js
@@ -1145,8 +1145,9 @@ WebInspector.CodeMirrorTextEditor.prototype = {
/**
* @param {!Array.<!WebInspector.TextRange>} ranges
+ * @param {number=} primarySelectionIndex
*/
- setSelections: function(ranges)
+ setSelections: function(ranges, primarySelectionIndex)
{
var selections = [];
for (var i = 0; i < ranges.length; ++i) {
@@ -1156,7 +1157,8 @@ WebInspector.CodeMirrorTextEditor.prototype = {
head: selection.end
});
}
- this._codeMirror.setSelections(selections, 0, { scroll: false });
+ primarySelectionIndex = primarySelectionIndex || 0;
+ this._codeMirror.setSelections(selections, primarySelectionIndex, { scroll: false });
},
/**
@@ -1836,7 +1838,7 @@ WebInspector.CodeMirrorTextEditor.SelectNextOccurrenceController.prototype = {
selections.push(next);
this._muteSelectionListener = true;
- this._textEditor.setSelections(selections);
+ this._textEditor.setSelections(selections, selections.length - 1);
delete this._muteSelectionListener;
this._textEditor._revealLine(next.startLine);
@@ -1857,7 +1859,7 @@ WebInspector.CodeMirrorTextEditor.SelectNextOccurrenceController.prototype = {
var newSelection = new WebInspector.TextRange(startRangeWord.startLine, startRangeWord.startColumn, endRangeWord.endLine, endRangeWord.endColumn);
newSelections.push(newSelection);
}
- this._textEditor.setSelections(newSelections);
+ this._textEditor.setSelections(newSelections, newSelections.length - 1);
this._fullWordSelection = true;
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698