question: private void shiftSegments ( int fromIdx , int offset ) { for ( Element element : elements ) { if ( element . end . left > fromIdx ) { shiftSegment ( element . start , fromIdx , offset ) ; shiftSegment ( element . end , fromIdx , offset ) ; if ( element . text != null ) { for ( Segment textSegment : element . text ) { shiftSegment ( textSegment , fromIdx , offset ) ; } } } } }
target:  Iterates all existed elements and shifts their segments if needed