X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fautos.C;h=ced078364c5578980abe367c9324b39109f1adf9;hp=b895a9049085c03a99db492cc171c90ace8fa2c3;hb=7e5a0760f40ff787cc3d93cb7768a901ebe52809;hpb=d348518c261d543e12282d516768d4f446434a42 diff --git a/cinelerra-5.1/cinelerra/autos.C b/cinelerra-5.1/cinelerra/autos.C index b895a904..ced07836 100644 --- a/cinelerra-5.1/cinelerra/autos.C +++ b/cinelerra-5.1/cinelerra/autos.C @@ -502,15 +502,17 @@ int Autos::copy(int64_t start, //printf("Autos::copy 10 %d %d %p\n", default_only, start, autoof(start)); if(active_only || (!default_only && !active_only)) { - for(Auto* current = autoof(start); - current && current->position <= end; - current = NEXT) - { + Auto *current = autoof(start); +// need the last one if past the end + if( !current && last ) + last->copy(start, end, file, default_only); + + while( current && current->position <= end ) { // Want to copy single keyframes by putting the cursor on them - if(current->position >= start && current->position <= end) - { + if( current->position >= start && current->position <= end ) { current->copy(start, end, file, default_only); } + current = NEXT; } } // Copy default auto again to make it the active auto on the clipboard @@ -703,22 +705,14 @@ Auto* Autos::autoof(int64_t position) Auto* Autos::nearest_before(int64_t position) { Auto *current; - - for(current = last; current && current->position >= position; current = PREVIOUS) - { ; } - - + for(current = last; current && current->position >= position; current = PREVIOUS); return current; // return 0 on failure } Auto* Autos::nearest_after(int64_t position) { Auto *current; - - for(current = first; current && current->position <= position; current = NEXT) - { ; } - - + for(current = first; current && current->position <= position; current = NEXT); return current; // return 0 on failure }