pub fn remove_segments(&mut self) {
        if !self.can_remove_segments() {
            return;
        }

        let mut removed = 0;
        for i in 0..self.run.len() {
            if self.selected_segments.contains(&i) {
                let segment_index = i - removed;
                self.fix_after_deletion(segment_index);
                self.run.segments_mut().remove(segment_index);
                removed += 1;
            }
        }

        let selected_segment = self.active_segment_index();
        let above_count = self
            .selected_segments
            .iter()
            .filter(|&&i| i < selected_segment)
            .count();
        let mut new_index = selected_segment - above_count;
        if new_index >= self.run.len() {
            new_index = self.run.len() - 1;
        }
        self.selected_segments.clear();
        self.selected_segments.push(new_index);

        self.times_modified();
        self.fix();
    }
/// Removes all the selected segments, unless all of them are selected. The
/// run's information is automatically adjusted properly. The next
/// not-to-be-removed segment after the active segment becomes the new
/// active segment. If there's none, then the next not-to-be-removed segment
/// before the active segment, becomes the new active segment.
Removes all the selected segments, unless all of them are selected. The
run's information is automatically adjusted properly. The next
not-to-be-removed segment after the active segment becomes the new
active segment. If there's none, then the next not-to-be-removed segment
before the active segment, becomes the new active segment.
Removes all the selected segments unless all of them are selected . The run ' s information is automatically adjusted properly . The next not - to - be - removed segment after the active segment becomes the new active segment . If there ' s none then the next not - to - be - removed segment before the active segment becomes the new active segment .
pub fn remove_segments(&mut self) {
        if !self.can_remove_segments() {
            return;
        }
        let mut removed = 0;
        for i in 0..self.run.len() {
            if self.selected_segments.contains(&i) {
                let segment_index = i - removed;
                self.fix_after_deletion(segment_index);
                self.run.segments_mut().remove(segment_index);
                removed += 1;
            }
        }
        let selected_segment = self.active_segment_index();
        let above_count = self
            .selected_segments
            .iter()
            .filter(|&&i| i < selected_segment)
            .count();
        let mut new_index = selected_segment - above_count;
        if new_index >= self.run.len() {
            new_index = self.run.len() - 1;
        }
        self.selected_segments.clear();
        self.selected_segments.push(new_index);
        self.times_modified();
        self.fix();
    }
pub fn remove_segments ( & mut self ) { if ! self . can_remove_segments ( ) { return ; } let mut removed = 0 ; for i in 0 .. self . run . len ( ) { if self . selected_segments . contains ( & i ) { let segment_index = i - removed ; self . fix_after_deletion ( segment_index ) ; self . run . segments_mut ( ) . remove ( segment_index ) ; removed += 1 ; } } let selected_segment = self . active_segment_index ( ) ; let above_count = self . selected_segments . iter ( ) . filter ( | & & i | i < selected_segment ) . count ( ) ; let mut new_index = selected_segment - above_count ; if new_index >= self . run . len ( ) { new_index = self . run . len ( ) - 1 ; } self . selected_segments . clear ( ) ; self . selected_segments . push ( new_index ) ; self . times_modified ( ) ; self . fix ( ) ; }
Removes all the selected segments, unless all of them are selected.
Removes all the selected segments unless all of them are selected .
&mut self
&mut self