mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user