Add segment.truncate and segment.expand attributes support

Ref #154
Ref #161