model.bytesUsed -= length;
}
private void insertAndFireEvent(int index, String text, String sessionId, String userId) {
assert index <= length();
TextInsertedEvent event =
new TextInsertedEventImpl(event(sessionId, userId).set("index", index).set("text", text));
snapshot.insert(index, text);
fireEvent(event);
model.bytesUsed += text.length();
}