- source->local_session->get_selectionstart();
- double overwrite_len = all ? source->tracks->total_length() :
- source->local_session->get_selectionend() - src_start;
+ src->inpoint_valid() ? src->get_inpoint() :
+ src->outpoint_valid() ? 0 :
+ src->get_selectionstart();
+ double src_end = all ? source->tracks->total_length() :
+ src->outpoint_valid() ? src->get_outpoint() :
+ src->inpoint_valid() ? source->tracks->total_length() :
+ src->get_selectionend();
+ double overwrite_len = src_end - src_start;