diff --git a/Region.C b/Region.C index 9f718a2..bad8649 100644 --- a/Region.C +++ b/Region.C @@ -113,9 +113,12 @@ Region::trim ( enum trim_e t, int X ) long td = timeline->x_to_ts( d ); - if ( td < 0 && _start < 0 - td ) + if ( td < 0 && _start < 0 - td ) td = 0 - _start; + if ( _start + td >= _end ) + td = (_end - _start) - timeline->x_to_ts( 1 ); + _start += td; _offset += td; break; @@ -128,7 +131,12 @@ Region::trim ( enum trim_e t, int X ) long td = timeline->x_to_ts( d ); - _end -= td; + printf( "%li %li\n", td, _end - _start ); + + if ( td >= 0 && _end - _start < td ) + _end = _start + timeline->x_to_ts( 1 ); + else + _end -= td; break; }