Try to add some sanity to indentation

This commit is contained in:
John McLear 2013-02-18 01:40:34 +00:00
parent 48ffbde731
commit 77d03d3473
2 changed files with 6 additions and 8 deletions

View File

@ -3287,7 +3287,7 @@ function Ace2Inner(){
listType = /([a-z]+)([12345678])/.exec(listType); listType = /([a-z]+)([12345678])/.exec(listType);
var type = listType[1]; var type = listType[1];
var level = Number(listType[2]); var level = Number(listType[2]);
//detect empty list item; exclude indentation //detect empty list item; exclude indentation
if(text === '*' && type !== "indent") if(text === '*' && type !== "indent")
{ {
@ -3317,8 +3317,10 @@ function Ace2Inner(){
function doIndentOutdent(isOut) function doIndentOutdent(isOut)
{ {
if (!(rep.selStart && rep.selEnd) || if (!((rep.selStart && rep.selEnd) ||
((rep.selStart[0] == rep.selEnd[0]) && (rep.selStart[1] == rep.selEnd[1]) && rep.selEnd[1] > 1)) ((rep.selStart[0] == rep.selEnd[0]) && (rep.selStart[1] == rep.selEnd[1]) && rep.selEnd[1] > 1)) &&
(isOut != true)
)
{ {
return false; return false;
} }
@ -3326,7 +3328,6 @@ function Ace2Inner(){
var firstLine, lastLine; var firstLine, lastLine;
firstLine = rep.selStart[0]; firstLine = rep.selStart[0];
lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] === 0) ? 1 : 0)); lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] === 0) ? 1 : 0));
var mods = []; var mods = [];
for (var n = firstLine; n <= lastLine; n++) for (var n = firstLine; n <= lastLine; n++)
{ {

View File

@ -156,10 +156,7 @@ var padeditbar = (function()
else if (cmd == 'insertorderedlist') ace.ace_doInsertOrderedList(); else if (cmd == 'insertorderedlist') ace.ace_doInsertOrderedList();
else if (cmd == 'indent') else if (cmd == 'indent')
{ {
if (!ace.ace_doIndentOutdent(false)) ace.ace_doIndentOutdent(false);
{
ace.ace_doInsertUnorderedList();
}
} }
else if (cmd == 'outdent') else if (cmd == 'outdent')
{ {