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

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

Issue 2080603008: DevTools: allow codemirror softundo to work on readonly files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing test for preserving readOnly Created 4 years, 6 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 | « third_party/WebKit/LayoutTests/inspector/editor/text-editor-ctrl-d-2.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js b/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
index 51bc5562847791c2893962fcfa54ffad9ced9824..da1cb2c41dc2e3d6782ac2f2cef15bdc771b36a5 100644
--- a/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
+++ b/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
@@ -964,6 +964,24 @@ WebInspector.CodeMirrorTextEditor.prototype = {
},
/**
+ * @param {string} key
+ * @param {*} value
+ */
+ setState: function(key, value)
lushnikov 2016/06/27 15:47:52 why is this public?
+ {
+ if (this._codeMirror.state)
+ this._codeMirror.state[key] = value;
lushnikov 2016/06/27 15:47:52 the "codeMirror.state" seems to be a part of CM in
+ },
+
+ /**
+ * @return {!Object}
+ */
+ getState: function()
+ {
+ return this._codeMirror.state || {};
+ },
+
+ /**
* @param {boolean} readOnly
*/
setReadOnly: function(readOnly)
@@ -2053,9 +2071,12 @@ WebInspector.CodeMirrorTextEditor.SelectNextOccurrenceController.prototype = {
undoLastSelection: function()
{
+ var wasSuppressingEdits = this._textEditor.getState()["suppressEdits"];
+ this._textEditor.setState("suppressEdits", false);
this._muteSelectionListener = true;
this._codeMirror.execCommand("undoSelection");
this._muteSelectionListener = false;
+ this._textEditor.setState("suppressEdits", wasSuppressingEdits);
},
selectNextOccurrence: function()
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/editor/text-editor-ctrl-d-2.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698