This commit is contained in:
cristo-rabani 2015-03-24 20:04:28 +01:00
parent 382804e44c
commit ed3ec96838
1 changed files with 29 additions and 25 deletions

View File

@ -175,13 +175,17 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({
if (!found) {
return;
}
ChangesetUtils.buildKeepToStartOfRange(this.rep, builder, [lineNum, 0]);
var list = _.chain(attribs).filter(function(a){return !!a[1];}).map(function(a){return a[0];}).value();
var countAttribsWithMarker = _.chain(attribs).filter(function(a){return !!a[1];})
.map(function(a){return a[0];}).difference(['author', 'lmkr', 'insertorder', 'start']).size().value();
//if we have marker and any of attributes don't need to have marker. we need delete it
if(hasMarker && !_.intersection(lineAttributes,list)){
ChangesetUtils.buildRemoveRange(this.rep, builder, [lineNum, 1], [lineNum, 2]);
if(hasMarker && !countAttribsWithMarker){
ChangesetUtils.buildRemoveRange(this.rep, builder, [lineNum, 0], [lineNum, 1]);
}else{
ChangesetUtils.buildKeepRange(this.rep, builder, [lineNum, 1], [lineNum, 2], attribs, this.rep.apool);
ChangesetUtils.buildKeepRange(this.rep, builder, [lineNum, 0], [lineNum, 1], attribs, this.rep.apool);
}
return this.applyChangeset(builder);