fix jshint complaints in codemirror directory

This commit is contained in:
ansuz
2016-02-12 16:20:55 +01:00
parent 2c5a2b6023
commit fe3917c0f1
3 changed files with 43 additions and 38 deletions

View File

@@ -93,23 +93,24 @@ var attachTextarea = function(elem, ctx, cmElem) {
// Replace the content of the text area with newText, and transform the
// current cursor by the specified function.
var replaceText = function(newText, transformCursor, transformCursorCM) {
var newCursor;
var newSelection;
if(cmElem) {
// Fix cursor here?
var cursorCM = cmElem.getCursor();
var cursorCMStart = cmElem.getCursor('from');
var cursorCMEnd = cmElem.getCursor('to');
var newCursor;
var newSelection;
if(cursorCMStart !== cursorCMEnd) {
newSelection = [transformCursorCM(elem.value, cursorCMStart), transformCursorCM(elem.value, cursorCMEnd)];
newSelection = [transformCursorCM(elem.value, cursorCMStart), transformCursorCM(elem.value, cursorCMEnd)];
}
else {
newCursor = transformCursorCM(elem.value, cursorCM);
newCursor = transformCursorCM(elem.value, cursorCM);
}
}
if (transformCursor && !cmElem) {
var newSelection = [transformCursor(elem.selectionStart), transformCursor(elem.selectionEnd)];
newSelection = [transformCursor(elem.selectionStart), transformCursor(elem.selectionEnd)];
}
// Fixate the window's scroll while we set the element's value. Otherwise