Thanks for the submission we will check. On Sun, Dec 31, 2017 at 4:26 PM, Bernhard Pieber <bernhard@pieber.com> wrote:
Hi Henrik,
Thanks for the fix. I just saw it today. In the meantime I have created a pull request with another fix. To be honest, I have just taken the working implementation from Squeak: https://github.com/pharo-project/pharo/pull/632
Alas, the CI check failed for some reason I don't understand. :-/
Happy New Year! Bernhard
Am 30.12.2017 um 13:32 schrieb Henrik-Nergaard <draagren@outlook.com>:
Here is a fix.
------------------------------------ PositionableStream>>#upToAll: aCollection "Answer a subcollection from the current access position to the occurrence (if any, but not inclusive) of aCollection. If aCollection is not in the stream, answer the entire rest of the stream."
| output pattern |
aCollection ifEmpty: [ ^ collection species empty ].
output := (collection species new: 100) writeStream. pattern := aCollection readStream.
[ pattern atEnd ] whileFalse: [ | item | self atEnd ifTrue: [ output next: pattern position putAll: aCollection startingAt: 1. ^ output contents ].
item := self next. (pattern peekFor: item) ifFalse: [ output next: pattern position putAll: aCollection startingAt: 1; nextPut: item.
pattern reset. ]. ].
^ output contents ------------------------------------
Best regards, Henrik