Fix clearMarkers when y=0 and avoid extra indexOf

This commit is contained in:
Daniel Imms
2022-02-22 06:38:01 -08:00
parent e08962b8b8
commit da5c24a33f
+6 -4
View File
@@ -587,10 +587,12 @@ export class Buffer implements IBuffer {
public clearMarkers(y?: number): void {
this._isClearing = true;
if (y) {
for (const marker of this.markers.filter(m => m.line === y)) {
marker.dispose();
this.markers.splice(this.markers.indexOf(marker), 1);
if (y !== undefined) {
for (let i = 0; i < this.markers.length; i++) {
if (this.markers[i].line === y) {
this.markers[i].dispose();
this.markers.splice(i, 1);
}
}
} else {
for (const marker of this.markers) {