Fix a unique index bug in transition models

When different segments of a transition model had rows both removed
and added it could cause the new-index tracking code to produce
duplicate indexes in the added rows (because segments with rows
removed would decrement the new-index counter).

This adds a test that triggers the bug and fixes the transitioner
so that it only modifies the new index counter if rows were added
for a segment.