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

Unified Diff: third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js

Issue 2565113002: DevTools: update console viewport scroll when prompt is resized (Closed)
Patch Set: rebaseline Created 3 years, 8 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
Index: third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
diff --git a/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js b/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
index ae2ff7df2041b48d9166cdf94826c9be82cf4e78..6bc94b351d5e722ba5db8ca44483345c8d3df32e 100644
--- a/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
+++ b/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
@@ -1022,8 +1022,10 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
editRange(range, text, origin) {
var pos = TextEditor.CodeMirrorUtils.toPos(range);
this._codeMirror.replaceRange(text, pos.start, pos.end, origin);
- return TextEditor.CodeMirrorUtils.toRange(
+ var newRange = TextEditor.CodeMirrorUtils.toRange(
pos.start, this._codeMirror.posFromIndex(this._codeMirror.indexFromPos(pos.start) + text.length));
+ this.dispatchEventToListeners(UI.TextEditor.Events.TextChanged, {oldRange: range, newRange: newRange});
+ return newRange;
}
/**
@@ -1069,6 +1071,25 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
this._decorations.valuesArray().forEach(decoration => this._codeMirror.removeLineWidget(decoration.widget));
this._decorations.clear();
+
+ var edits = [];
+ var currentEdit;
+
+ for (var changeIndex = 0; changeIndex < changes.length; ++changeIndex) {
+ var changeObject = changes[changeIndex];
+ var edit = TextEditor.CodeMirrorUtils.changeObjectToEditOperation(changeObject);
+ if (currentEdit && edit.oldRange.equal(currentEdit.newRange)) {
+ currentEdit.newRange = edit.newRange;
+ } else {
+ currentEdit = edit;
+ edits.push(currentEdit);
+ }
+ }
+
+ for (var i = 0; i < edits.length; i++) {
+ this.dispatchEventToListeners(
+ UI.TextEditor.Events.TextChanged, {oldRange: edits[i].oldRange, newRange: edits[i].newRange});
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698