From ba2db48dbb683db81f8fe171f81c86868d616be2 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Wed, 28 Dec 2016 22:37:07 +0100 Subject: [PATCH] Fix refactoring artifacts. --- app/assets/javascripts/discourse/components/d-editor.js.es6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6 index 52e35b8b31e..457ccda02cb 100644 --- a/app/assets/javascripts/discourse/components/d-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/d-editor.js.es6 @@ -537,14 +537,14 @@ export default Ember.Component.extend({ // Remember cursor/selection. const selectionStart = textarea.selectionStart; const selectionEnd = textarea.selectionEnd; - const needleEnd = needleStart + oldValue.length; + const needleEnd = needleStart + oldVal.length; const replacementEnd = needleStart + newVal.length; // Replace value (side effect: cursor at end). this.set('value', val.replace(oldVal, newVal)); // Determine cursor/selection. - const newSelectionStart, newSelectionEnd; + let newSelectionStart, newSelectionEnd; if (selectionEnd <= needleEnd) { // Selection before needle. newSelectionStart = selectionStart;