From 093075a2f771e8f2b993d2ac808edbb7e4027657 Mon Sep 17 00:00:00 2001 From: Aleksandar Prokopec Date: Fri, 18 May 2012 17:35:20 +0200 Subject: Fixes SI-4461. No review. --- .../scala/collection/mutable/ObservableBuffer.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/library/scala/collection/mutable/ObservableBuffer.scala b/src/library/scala/collection/mutable/ObservableBuffer.scala index a619edf281..6b5079e402 100644 --- a/src/library/scala/collection/mutable/ObservableBuffer.scala +++ b/src/library/scala/collection/mutable/ObservableBuffer.scala @@ -70,4 +70,18 @@ trait ObservableBuffer[A] extends Buffer[A] with Publisher[Message[A] with Undoa def undo() { throw new UnsupportedOperationException("cannot undo") } }) } + + abstract override def insertAll(n: Int, elems: collection.Traversable[A]) { + super.insertAll(n, elems) + var curr = n - 1 + val msg = elems.foldLeft(new Script[A]() with Undoable { + def undo() { throw new UnsupportedOperationException("cannot undo") } + }) { + case (msg, elem) => + curr += 1 + msg += Include(Index(curr), elem) + } + publish(msg) + } + } -- cgit v1.2.3