adjust trimming for 0-based coordinate system, closed-open range