Delete key removes line attributes if prev line is not emtpy

This commit is contained in:
Matthias Bartelmeß 2012-04-07 01:07:25 +02:00
parent 38276e636c
commit 34f07efcfb
1 changed files with 6 additions and 0 deletions

View File

@ -3365,6 +3365,9 @@ function Ace2Inner(){
var thisLineListType = getLineListType(theLine); var thisLineListType = getLineListType(theLine);
var prevLineEntry = (theLine > 0 && rep.lines.atIndex(theLine - 1)); var prevLineEntry = (theLine > 0 && rep.lines.atIndex(theLine - 1));
var prevLineBlank = (prevLineEntry && prevLineEntry.text.length == prevLineEntry.lineMarker); var prevLineBlank = (prevLineEntry && prevLineEntry.text.length == prevLineEntry.lineMarker);
var thisLineHasMarker = documentAttributeManager.lineHasMarker(theLine);
if (thisLineListType) if (thisLineListType)
{ {
// this line is a list // this line is a list
@ -3378,6 +3381,9 @@ function Ace2Inner(){
// delistify // delistify
performDocumentReplaceRange([theLine, 0], [theLine, lineEntry.lineMarker], ''); performDocumentReplaceRange([theLine, 0], [theLine, lineEntry.lineMarker], '');
} }
}else if (thisLineHasMarker && prevLineEntry){
// If the line has any attributes assigned, remove them by removing the marker '*'
performDocumentReplaceRange([theLine -1 , prevLineEntry.text.length], [theLine, lineEntry.lineMarker], '');
} }
else if (theLine > 0) else if (theLine > 0)
{ {