On Wed, May 18, 2016 at 11:11:17PM +0200, Sebastian Geerken wrote:
The attached patch works OK for the text search, but I don't know whether it fits with the overall design.
It *seems to fit* but I'd prefer you to check it. ;)
I've just pushed a variant of your patch, please give it a try.
Much better!
I still wander what a negative sectionIndex means (0 is in flow). It takes negative values sometimes. It should be commented.
It happens when iterating back gets behind 0. Likewise, it may become larger than NUM_SECTIONS - 1, when iterating forward.
Yep, it also happens with "index".
What should getPart() do upon a negative sectionIndex?
It should not be called, actually. This should be checked, first.
OK, I've rewrote next() and prev() with full protection and made clear semantics for the corner cases in setValues(). As a side effect, the code got shorter and easier to read. Now in testing phase... -- Cheers Jorge.-