-
Notifications
You must be signed in to change notification settings - Fork 104
Closed
Description
buffer.remove() resets its first index when it gets empty with the code bellow:
if(!buffer.length) {
buffer.first = 1;
buffer.next = 1;
}
This actually has a few issues:
- It resets it to
1while it should better usestartIndex. This has consequences when the start index is0. Even better, it should useminIndexif it exists. - It does not reset eof. Suppose that we start from the following buffer
{first=10, length=5, eof=true}. Now we remove the 5 elements in the buffer. It leads to a situation wherefirst=1buteof=true. As a result, it thinks that1is the latest element and thus it does not display the remaining ones up to 10.
I suggest the following fix:
if(!buffer.length) {
buffer.first = buffer.minIndex!==undefined ? buffer.minIndex : startIndex;
buffer.next = buffer.first;
buffer.eof = buffer.eof && buffer.first==buffer.maxIndex;
}
Metadata
Metadata
Assignees
Labels
No labels