From d09eb4c9f46010a9daf0c6eea4f9042f674d0a11 Mon Sep 17 00:00:00 2001 From: Martin Zagora Date: Tue, 1 Nov 2016 17:56:50 +1100 Subject: [PATCH] when reseting text in editor, ignore line-ending differences --- src/editor/Editor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/editor/Editor.js b/src/editor/Editor.js index 99203dc8341..2bab93c1044 100644 --- a/src/editor/Editor.js +++ b/src/editor/Editor.js @@ -1048,7 +1048,11 @@ define(function (require, exports, module) { */ Editor.prototype._resetText = function (text) { var currentText = this._codeMirror.getValue(); - if (text === currentText) { + + // compare with ignoring line-endings, issue #11826 + var textLF = text ? text.replace(/(\r\n|\r|\n)/g, "\n") : null; + var currentTextLF = currentText ? currentText.replace(/(\r\n|\r|\n)/g, "\n") : null; + if (textLF === currentTextLF) { // there's nothing to reset return; }