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);
var type = listType[1];
var level = Number(listType[2]);
//detect empty list item; exclude indentation
if(text === '*' && type !== "indent")
{
@ -3317,8 +3317,10 @@ function Ace2Inner(){
function doIndentOutdent(isOut)
{
if (!(rep.selStart && rep.selEnd) ||
((rep.selStart[0] == rep.selEnd[0]) && (rep.selStart[1] == rep.selEnd[1]) && rep.selEnd[1] > 1))
if (!((rep.selStart && rep.selEnd) ||
((rep.selStart[0] == rep.selEnd[0]) && (rep.selStart[1] == rep.selEnd[1]) && rep.selEnd[1] > 1)) &&
(isOut != true)
)
{
return false;
}
@ -3326,7 +3328,6 @@ function Ace2Inner(){
var firstLine, lastLine;
firstLine = rep.selStart[0];
lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] === 0) ? 1 : 0));
var mods = [];
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 == 'indent')
{
if (!ace.ace_doIndentOutdent(false))
{
ace.ace_doInsertUnorderedList();
}
ace.ace_doIndentOutdent(false);
}
else if (cmd == 'outdent')
{