diff --git a/assets/js/icecoder.js b/assets/js/icecoder.js index 469d7ad..2820682 100644 --- a/assets/js/icecoder.js +++ b/assets/js/icecoder.js @@ -4925,29 +4925,29 @@ var ICEcoder = { // Reset the state of keys back to the normal state resetKeys: function(evt) { - var key, cM; + let key, thisCM; key = evt.keyCode ?? evt.which ?? evt.charCode; - if (key == 112 && true === this.codeZoomedOut) { - cM = this.getcMInstance(); + if (112 === key && true === this.codeZoomedOut) { + thisCM = this.getcMInstance(); // For every line in the current editor, remove code-zoomed-out class if not a function/class declaration line - for (var i=0; i-1) { + if (-1 < lineContents.indexOf(tgtString)) { // Get text on the line from our target to the end remainder = thisCM.getLine(lineNo); strPos = remainder.indexOf(tgtString); - remainder = remainder.slice(remainder.indexOf(tgtString)+tgtString.length+1); + remainder = remainder.slice(remainder.indexOf(tgtString) + tgtString.length + 1); // Replace the function name if any - replaceString = replaceString.replace(/VAR/g,remainder); + replaceString = replaceString.replace(/VAR/g, remainder); // Get replaced string from start to our strPos - replacedLine = thisCM.getLine(lineNo).slice(0,strPos); + replacedLine = thisCM.getLine(lineNo).slice(0, strPos); // Trim whitespace from start whiteSpace = thisCM.getLine(lineNo).length - thisCM.getLine(lineNo).replace(/^\s\s*/, '').length; - whiteSpace = thisCM.getLine(lineNo).slice(0,whiteSpace); + whiteSpace = thisCM.getLine(lineNo).slice(0, whiteSpace); // Replace indent with whatever whitespace we have - replaceString = replaceString.replace(/INDENT/g,whiteSpace); + replaceString = replaceString.replace(/INDENT/g, whiteSpace); replacedLine += replaceString; // Get cursor position curPos = replacedLine.indexOf("CURSOR"); sPos = 0; lineNoCount = lineNo; - for (i=0;i -1 ? true : false); + this.focus(-1 < this.editorFocusInstance.indexOf('diff') ? true : false); } },