Index: Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js |
diff --git a/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js b/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js |
index 70f5a7b8389ef7df5ee343593ef0076299c9f612..981557827453f96bc25888c9344c0c94f8d18e66 100644 |
--- a/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js |
+++ b/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js |
@@ -555,6 +555,11 @@ WebInspector.CodeMirrorTextEditor.prototype = { |
this._codeMirror.refresh(); |
}, |
+ willHide: function() |
+ { |
+ delete this._editorSizeInSync; |
+ }, |
+ |
_guessIndentationLevel: function() |
{ |
var tabRegex = /^\t+/; |
@@ -1182,6 +1187,11 @@ WebInspector.CodeMirrorTextEditor.prototype = { |
{ |
this._autocompleteController.finishAutocomplete(); |
this._resizeEditor(); |
+ this._editorSizeInSync = true; |
+ if (this._selectionSetScheduled) { |
+ delete this._selectionSetScheduled; |
+ this.setSelection(this._lastSelection); |
+ } |
}, |
/** |
@@ -1387,6 +1397,10 @@ WebInspector.CodeMirrorTextEditor.prototype = { |
setSelection: function(textRange) |
{ |
this._lastSelection = textRange; |
+ if (!this._editorSizeInSync) { |
+ this._selectionSetScheduled = true; |
+ return; |
+ } |
var pos = WebInspector.CodeMirrorUtils.toPos(textRange); |
this._codeMirror.setSelection(pos.start, pos.end); |
}, |