fixing lineHasMarker

This commit is contained in:
Matthias Bartelmeß 2012-04-05 01:07:47 +02:00
parent 1b383dc9b8
commit 60942b09a4
2 changed files with 13 additions and 5 deletions

View File

@ -7,6 +7,10 @@ var AttributeManager = function(rep, applyChangesetCallback)
this.rep = rep;
this.applyChangesetCallback = applyChangesetCallback;
this.author = '';
// If the first char in a line has one of the following attributes
// it will be considered as a line marker
this.lineAttributes = ['list'];
};
AttributeManager.prototype = _(AttributeManager.prototype).extend({
@ -21,7 +25,13 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({
lineHasMarker: function(lineNum){
// get "list" attribute of first char of line
return this.getAttributeOnLine(lineNum, 'list');
var that = this;
return _.find(this.lineAttributes, function(attribute){
return that.getAttributeOnLine(lineNum, attribute) != '';
}) !== undefined;
},
getAttributeOnLine: function(lineNum, attributeName){
@ -80,8 +90,6 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({
var builder = Changeset.builder(this.rep.lines.totalWidth());
var hasMarker = this.lineHasMarker(lineNum);
// TODO
if(hasMarker){
ChangesetUtils.buildKeepRange(this.rep, builder, loc, (loc = [lineNum, 0]), [
[attributeName, attributeValue]

View File

@ -3320,7 +3320,7 @@ function Ace2Inner(){
}
_.each(mods, function(mod){
setLineListType.apply(this, mod);
setLineListType(mod[0], mod[1]);
});
return true;
}
@ -4977,7 +4977,7 @@ function Ace2Inner(){
}
_.each(mods, function(mod){
setLineListType.apply(this, mod);
setLineListType(mod[0], mod[1]);
});
}