This commit is contained in:
Vadim Lopatin 2015-12-15 12:39:28 +03:00
parent 4feb9d8f2a
commit f5dd9dbc99
1 changed files with 8 additions and 3 deletions

View File

@ -1455,14 +1455,14 @@ class LineIcon {
/// line number /// line number
int line; int line;
/// arbitrary parameter /// arbitrary parameter
Object param; Object objectParam;
/// empty /// empty
this() { this() {
} }
this(LineIconType type, int line, Object obj = null) { this(LineIconType type, int line, Object obj = null) {
this.type = type; this.type = type;
this.line = line; this.line = line;
this.param = null; this.objectParam = obj;
} }
} }
@ -1522,22 +1522,27 @@ struct LineIcons {
_len--; _len--;
return res; return res;
} }
/// remove icon mark /// remove icon mark
LineIcon remove(LineIcon icon) { LineIcon remove(LineIcon icon) {
// same object
for (int i = 0; i < _len; i++) { for (int i = 0; i < _len; i++) {
if (_items[i] is icon) if (_items[i] is icon)
return remove(i); return remove(i);
} }
// has the same objectParam
for (int i = 0; i < _len; i++) { for (int i = 0; i < _len; i++) {
if (_items[i].param !is null && icon.param !is null && _items[i].param is icon.param) if (_items[i].objectParam !is null && icon.objectParam !is null && _items[i].objectParam is icon.objectParam)
return remove(i); return remove(i);
} }
// has same line and type
for (int i = 0; i < _len; i++) { for (int i = 0; i < _len; i++) {
if (_items[i].line == icon.line && _items[i].type == icon.type) if (_items[i].line == icon.line && _items[i].type == icon.type)
return remove(i); return remove(i);
} }
return null; return null;
} }
/// remove all icon marks of specified type, return true if any of items removed /// remove all icon marks of specified type, return true if any of items removed
bool removeByType(LineIconType type) { bool removeByType(LineIconType type) {
bool res = false; bool res = false;