Finally fix AttribManager#removeAttributeOnLine
return safely if the attribute wasn't found. fixes #2394pull/2442/head
parent
e2ea82f8df
commit
751adb24fd
|
@ -164,12 +164,20 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({
|
|||
var builder = Changeset.builder(this.rep.lines.totalWidth());
|
||||
var hasMarker = this.lineHasMarker(lineNum);
|
||||
var attribs
|
||||
var foundAttrib = false
|
||||
|
||||
attribs = this.getAttributesOnLine(lineNum).map(function(attrib) {
|
||||
if(attrib[0] === attributeName) return [attributeName, null]
|
||||
if(attrib[0] === attributeName) {
|
||||
foundAttrib = true
|
||||
return [attributeName, null] // remove this attrib from the linemarker
|
||||
}
|
||||
return attrib
|
||||
})
|
||||
|
||||
if(!foundAttrib) {
|
||||
return
|
||||
}
|
||||
|
||||
if(hasMarker){
|
||||
ChangesetUtils.buildKeepRange(this.rep, builder, loc, (loc = [lineNum, 0]));
|
||||
// If length == 4, there's [author, lmkr, insertorder, + the attrib being removed] thus we can remove the marker entirely
|
||||
|
|
Loading…
Reference in New Issue