Permalink
Browse files

Fixes SI-4461.

No review.
  • Loading branch information...
axel22 committed May 18, 2012
1 parent 34fa132 commit 093075a2f771e8f2b993d2ac808edbb7e4027657
@@ -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)
}
}
@@ -4,4 +4,8 @@ Include(End,3)
Include(End,4)
Include(End,5)
Include(End,6)
Include(End,7)
Include(End,7)
Script([1] Include(Index(7),8), [2] Include(Index(8),9), [3] Include(Index(9),10))
Include(Start,0)
Script([1] Include(Index(0),-2), [2] Include(Index(1),-1))
Remove(Index(0),-2)
@@ -15,5 +15,9 @@ object Test {
buf ++= ArrayBuffer(3, 4) // works
buf ++= List(5) // works
buf ++= collection.immutable.Vector(6, 7) // works
buf.insertAll(7, List(8, 9, 10))
0 +=: buf
List(-2, -1) ++=: buf
buf remove 0
}
}

0 comments on commit 093075a

Please sign in to comment.