diff --git a/lib/ice-coder.js b/lib/ice-coder.js
index 3d8dd6a..0861be3 100644
--- a/lib/ice-coder.js
+++ b/lib/ice-coder.js
@@ -426,6 +426,31 @@ var ICEcoder = {
cM.replaceRange(cM.getLine(line)+"
",{line:line,ch:0},{line:line,ch:1000000});
},
+ // Insert a line before and auto-indent
+ insertLineBefore: function(line) {
+ var cM;
+
+ cM = ICEcoder.getcMInstance();
+ if (!line) {line = cM.getCursor().line};
+ cM.operation(function() {
+ cM.replaceRange("\n"+cM.getLine(line),{line:line,ch:0},{line:line,ch:1000000});
+ cM.setCursor({line: cM.getCursor().line-1, ch: 0});
+ cM.execCommand('indentAuto');
+ });
+ },
+
+ // Insert a line after and auto-indent
+ insertLineAfter: function(line) {
+ var cM;
+
+ cM = ICEcoder.getcMInstance();
+ if (!line) {line = cM.getCursor().line};
+ cM.operation(function() {
+ cM.replaceRange(cM.getLine(line)+"\n",{line:line,ch:0},{line:line,ch:1000000});
+ cM.execCommand('indentAuto');
+ });
+ },
+
// Duplicate line
duplicateLines: function(line) {
var cM, ch, lineExtra, userSelStart, userSelEnd, lineBreak;
@@ -2501,12 +2526,20 @@ var ICEcoder = {
else if (key==51) {top.ICEcoder.tagWrapper('h3'); return false;}
else if (key==13) {top.ICEcoder.addLineBreakAtEnd(); return false;}
else {return key;}
+ // Alt+Enter (Insert Line After)
+ } else if (key==13) {
+ top.ICEcoder.insertLineAfter();
} else {return key;}
} else {
+ // Shift+Enter (Insert Line Before)
+ if(key==13 && evt.shiftKey) {
+ top.ICEcoder.insertLineBefore();
+ return false;
+
// CTRL/Cmd+F (Find)
- if(key==70 && (evt.ctrlKey||top.ICEcoder.cmdKey)) {
+ } else if(key==70 && (evt.ctrlKey||top.ICEcoder.cmdKey)) {
top.get('find').focus();
return false;
diff --git a/lib/ice-coder.min.js b/lib/ice-coder.min.js
index 89d15d8..3e3d73a 100644
--- a/lib/ice-coder.min.js
+++ b/lib/ice-coder.min.js
@@ -13,8 +13,9 @@ top.ICEcoder.dontUpdateNest=!1;else{top.ICEcoder.cursorOrigCh=c.getCursor().ch;t
1!=a&&g++);e.from()&&(d={},top.ICEcoder.startPosLine=d.line=e.from().line,top.ICEcoder.startPosCh=d.ch=e.from().ch,e={},e.line=top.ICEcoder.content.contentWindow.CodeMirror.fold.xml(c,d)||d.line,e.line=e.line.to?e.line.to.line:e.line,e.ch=c.getLine(e.line).indexOf(""+top.ICEcoder.htmlTagArray[a]+">")+top.ICEcoder.htmlTagArray[a].length+3,top.ICEcoder.dontSelect?top.ICEcoder.dontSelect=!1:c.setSelection(d,e),c.scrollIntoView(d))}},setPosition:function(a,b,c){var d;d=ICEcoder.getcMInstance();c=d.getLine(b).indexOf(">",
d.getLine(b).indexOf("<"+c))+1;d.setCursor(b,c);top.ICEcoder.focus();for(d=b=0;d<=a;d++)b=ICEcoder.nestDisplay.innerHTML.indexOf(">",b+1);ICEcoder.nestDisplay.innerHTML=ICEcoder.nestDisplay.innerHTML.substr(0,b).replace(/<(?:.|\n)*?>/gm,"");top.ICEcoder.dontUpdateNest=!1;top.ICEcoder.dontSelect=!0},tagWrapper:function(a){var b,c,d,e;b=ICEcoder.getcMInstance();c=a;"div"==a?(d=b.getCursor("start").line,e=b.getCursor().line,b.operation(function(){b.replaceSelection("
\n"+b.getSelection()+"\n
",
"around");for(var a=d+1;a<=e+1;a++)b.indentLine(a);b.indentLine(e+2,"prev");b.indentLine(e+2,"subtract")})):-1<"p a b i strong em h1 h2 h3 h4 h5 h6".split(" ").indexOf(a)&&b.getSelection().substr(0,a.length+1)=="<"+c&&b.getSelection().substr(-(a.length+3))==""+a+">"?b.replaceSelection(b.getSelection().substr(b.getSelection().indexOf(">")+1,b.getSelection().length-b.getSelection().indexOf(">")-1-a.length-3),"around"):("a"==a&&(c='a href=""'),b.replaceSelection("<"+c+">"+b.getSelection()+""+a+">",
-"around"),"a"==a&&b.setCursor({line:b.getCursor("start").line,ch:b.getCursor("start").ch+9}))},addLineBreakAtEnd:function(a){var b;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);b.replaceRange(b.getLine(a)+"
",{line:a,ch:0},{line:a,ch:1E6})},duplicateLines:function(a){var b,c,d;b=ICEcoder.getcMInstance();!a&&b.somethingSelected()?(c=b.getCursor("start"),d=b.getCursor("end"),a=c.line!=d.line&&d.ch==b.getLine(d.line).length?"\n":"",b.replaceSelection(b.getSelection()+a+b.getSelection(),"end"),
-b.setSelection(c,d)):(a||(a=b.getCursor().line),c=b.getCursor().ch,b.replaceRange(b.getLine(a)+"\n"+b.getLine(a),{line:a,ch:0},{line:a,ch:1E6}),b.setCursor(a+1,c))},removeLines:function(a){var b,c;b=ICEcoder.getcMInstance();!a&&b.somethingSelected()?b.replaceSelection("","end"):(a||(a=b.getCursor().line),c=b.getCursor().ch,b.execCommand("deleteLine"),b.setCursor(a-1,c))},jumpToDefinition:function(){var a,b;a=ICEcoder.getcMInstance();b=a.getTokenAt(a.getCursor()).string;if(a.somethingSelected()&&top.ICEcoder.origCurorPos)a.setCursor(top.ICEcoder.origCurorPos);
+"around"),"a"==a&&b.setCursor({line:b.getCursor("start").line,ch:b.getCursor("start").ch+9}))},addLineBreakAtEnd:function(a){var b;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);b.replaceRange(b.getLine(a)+"
",{line:a,ch:0},{line:a,ch:1E6})},insertLineBefore:function(a){var b;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);b.operation(function(){b.replaceRange("\n"+b.getLine(a),{line:a,ch:0},{line:a,ch:1E6});b.setCursor({line:b.getCursor().line-1,ch:0});b.execCommand("indentAuto")})},
+insertLineAfter:function(a){var b;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);b.operation(function(){b.replaceRange(b.getLine(a)+"\n",{line:a,ch:0},{line:a,ch:1E6});b.execCommand("indentAuto")})},duplicateLines:function(a){var b,c,d;b=ICEcoder.getcMInstance();!a&&b.somethingSelected()?(c=b.getCursor("start"),d=b.getCursor("end"),a=c.line!=d.line&&d.ch==b.getLine(d.line).length?"\n":"",b.replaceSelection(b.getSelection()+a+b.getSelection(),"end"),b.setSelection(c,d)):(a||(a=b.getCursor().line),
+c=b.getCursor().ch,b.replaceRange(b.getLine(a)+"\n"+b.getLine(a),{line:a,ch:0},{line:a,ch:1E6}),b.setCursor(a+1,c))},removeLines:function(a){var b,c;b=ICEcoder.getcMInstance();!a&&b.somethingSelected()?b.replaceSelection("","end"):(a||(a=b.getCursor().line),c=b.getCursor().ch,b.execCommand("deleteLine"),b.setCursor(a-1,c))},jumpToDefinition:function(){var a,b;a=ICEcoder.getcMInstance();b=a.getTokenAt(a.getCursor()).string;if(a.somethingSelected()&&top.ICEcoder.origCurorPos)a.setCursor(top.ICEcoder.origCurorPos);
else for(top.ICEcoder.origCurorPos=a.getCursor(),a=["var "+b,"function "+b,b+"=function",b+"= function",b+" =function",b+" = function",b+"=new function",b+"= new function",b+" =new function",b+" = new function","window['"+b+"']",'window["'+b+'"]',"this['"+b+"']",'this["'+b+'"]',b+":",b+" :","def "+b,"class "+b],b=0;b=top.ICEcoder.tabLeftPos[c-1]?top.ICEcoder.tabLeftPos[c-1]-b:top
c).style.zIndex=1},150);if(top.ICEcoder.thisLeft&&!1!==top.ICEcoder.thisLeft){b=[];for(c=1;c<=top.ICEcoder.openFiles.length;c++)b.push(c);b.splice(top.ICEcoder.dragTabNo-1,1);b.splice(a-1,0,top.ICEcoder.dragTabNo);ICEcoder.sortTabs(b)}top.ICEcoder.setTabWidths();top.ICEcoder.draggingTab=!1;top.ICEcoder.thisLeft=!1},sortTabs:function(a){var b,c,d;b=[ICEcoder.savedPoints,ICEcoder.openFiles,ICEcoder.openFileMDTs,ICEcoder.cMInstances];c=[[],[],[],[]];for(var e=0;e