pub fn undo(&mut self, steps: usize) -> EditResult<Node::Class> {
        log::trace!("Performing undo.");
        // Early return if there are no changes to undo
        if self.history_index == 0 {
            return Err(EditErr::NoChangesToUndo);
        }
        // Move the history index back by one to perform the undo
        self.history_index = self.history_index.saturating_sub(steps);
        // Follow the behaviour of other text editors and update the location of the cursor
        // with its location in the snapshot we are going forward to
        self.current_cursor_path
            .clone_from(&self.root_history[self.history_index + 1].cursor_before);
        log::debug!("Setting cursor path to {:?}", self.current_cursor_path);
        Ok(EditSuccess::Undo)
    }
/// Move one step back in the tree history
Move one step back in the tree history
Move one step back in the tree history
pub fn undo(&mut self, steps: usize) -> EditResult<Node::Class> {
        log::trace!("Performing undo.");
        // Early return if there are no changes to undo
        if self.history_index == 0 {
            return Err(EditErr::NoChangesToUndo);
        }
        // Move the history index back by one to perform the undo
        self.history_index = self.history_index.saturating_sub(steps);
        // Follow the behaviour of other text editors and update the location of the cursor
        // with its location in the snapshot we are going forward to
        self.current_cursor_path
            .clone_from(&self.root_history[self.history_index + 1].cursor_before);
        log::debug!("Setting cursor path to {:?}", self.current_cursor_path);
        Ok(EditSuccess::Undo)
    }
pub fn undo ( & mut self , steps : usize ) -> EditResult < Node :: Class > { log :: trace ! ( " " ) ; // Early return if there are no changes to undo if self . history_index == 0 { return Err ( EditErr :: NoChangesToUndo ) ; } // Move the history index back by one to perform the undo self . history_index = self . history_index . saturating_sub ( steps ) ; // Follow the behaviour of other text editors and update the location of the cursor // with its location in the snapshot we are going forward to self . current_cursor_path . clone_from ( & self . root_history [ self . history_index + 1 ] . cursor_before ) ; log :: debug ! ( " " self current_cursor_path ) ; Ok ( EditSuccess :: Undo ) }
Move one step back in the tree history
Move one step back in the tree history
&mut self
steps
usize
&mut self
steps
usize