Closed priandsf closed 4 years ago
@priandsf I opened PR #233. There a lot of changes, but they are mostly refactoring. Three files relate to our problem:
adapter.js buffer.js BufferCleanupSpec.js
The spec file contains scenarios, you may see how the indexes are evolving during cleaning the Buffer with and without immutableTop
option in BOF/EOF and non-BOF/EOF cases.
Looks like it works without changes you suggested above. Moreover, my buffer.js change is also unnecessary. It is here for a consistency purpose that doesn't impact the behaviour.
May I ask you to look at this and say what do you think? does it satisfy your needs? do you have some scenarios which would be broken with this approach? can you introduce these scenarios in BufferCleanupSpec?
Closing per v1.8.2 containing the fix is released.
buffer.remove()
resets its first index when it gets empty with the code bellow:This actually has a few issues:
1
while it should better usestartIndex
. This has consequences when the start index is0
. Even better, it should useminIndex
if it exists.{first=10, length=5, eof=true}
. Now we remove the 5 elements in the buffer. It leads to a situation wherefirst=1
buteof=true
. As a result, it thinks that1
is the latest element and thus it does not display the remaining ones up to 10.I suggest the following fix: