Declaring function vars and adjusting var name

Establishing vars at beginning of function to stop them being globals
lineNo2 now lineCount
This commit is contained in:
Matt Pass
2012-12-27 14:33:07 +00:00
parent 5887a9c755
commit dd19c39cf8

View File

@@ -1844,8 +1844,9 @@ var ICEcoder = {
else if (key==46) {top.ICEcoder.delKeyDown = false}
},
// Add snippet panel below line
addSnippet: function() {
var cM;
var cM, lineNo, whiteSpace, content;
if (top.ICEcoder.snippetLine!==false) {
top.ICEcoder.removeSnippet();
@@ -1869,8 +1870,9 @@ var ICEcoder = {
}
},
// Action a snippet
doSnippet: function(tgtString,replaceString) {
var cM, lineNo, lineContents, replacedLine;
var cM, lineNo, lineContents, remainder, strPos, replacedLine, whiteSpace, curPos, sPos, lineNoCount;
cM = top.ICEcoder.getcMInstance();
lineNo = cM.getCursor().line;
@@ -1887,20 +1889,21 @@ var ICEcoder = {
replacedLine += replaceString;
curPos = replacedLine.indexOf("CURSOR");
sPos = 0;
lineNo2 = lineNo;
lineNoCount = lineNo;
for (i=0;i<replacedLine.length;i++) {
if (replacedLine.indexOf("\n",sPos)<replacedLine.indexOf("CURSOR")) {
sPos = replacedLine.indexOf("\n",sPos)+1;
lineNo2 = lineNo2+1;
lineNoCount = lineNoCount+1;
}
}
cM.setLine(lineNo, replacedLine.replace("CURSOR",""));
cM.setCursor(lineNo2,curPos);
cM.setCursor(lineNoCount,curPos);
cM.focus();
top.ICEcoder.removeSnippet();
}
},
// Remove snippet panel
removeSnippet: function() {
var cM;