pub fn apply_plugin_edit(&mut self, edit: &PluginEdit, undo_group: Option<usize>) {
        let interval = Interval::new_closed_open(edit.start as usize, edit.end as usize);
        let text = Rope::from(&edit.text);
        let rev_len = self.engine.get_rev(edit.rev).unwrap().len();
        let delta = Delta::simple_edit(interval, text, rev_len);

        if let Some(undo_group) = undo_group {
            // non-async edits modify their associated revision
            //TODO: get priority working, so that plugin edits don't necessarily move cursor
            self.engine.edit_rev(edit.priority as usize, undo_group, edit.rev, delta);
            self.text = self.engine.get_head().clone();
        }
        else {
            self.add_delta(delta);
        }

        self.commit_delta(Some(&edit.author));
        self.render();
    }
//TODO: plugin edits should be represented by real Deltas.
/// generates a delta from a plugin's response and applies it to the buffer.
plugin edits should be represented by real Deltas.
generates a delta from a plugin's response and applies it to the buffer.
plugin edits should be represented by real Deltas . generates a delta from a plugin ' s response and applies it to the buffer .
pub fn apply_plugin_edit(&mut self, edit: &PluginEdit, undo_group: Option<usize>) {
        let interval = Interval::new_closed_open(edit.start as usize, edit.end as usize);
        let text = Rope::from(&edit.text);
        let rev_len = self.engine.get_rev(edit.rev).unwrap().len();
        let delta = Delta::simple_edit(interval, text, rev_len);
        if let Some(undo_group) = undo_group {
            // non-async edits modify their associated revision
            //TODO: get priority working, so that plugin edits don't necessarily move cursor
            self.engine.edit_rev(edit.priority as usize, undo_group, edit.rev, delta);
            self.text = self.engine.get_head().clone();
        }
        else {
            self.add_delta(delta);
        }
        self.commit_delta(Some(&edit.author));
        self.render();
    }
pub fn apply_plugin_edit ( & mut self , edit : & PluginEdit , undo_group : Option < usize > ) { let interval = Interval :: new_closed_open ( edit . start as usize , edit . end as usize ) ; let text = Rope :: from ( & edit . text ) ; let rev_len = self . engine . get_rev ( edit . rev ) . unwrap ( ) . len ( ) ; let delta = Delta :: simple_edit ( interval , text , rev_len ) ; if let Some ( undo_group ) = undo_group { // non-async edits modify their associated revision //TODO: get priority working, so that plugin edits don't necessarily move cursor self . engine . edit_rev ( edit . priority as usize , undo_group , edit . rev , delta ) ; self . text = self . engine . get_head ( ) . clone ( ) ; } else { self . add_delta ( delta ) ; } self . commit_delta ( Some ( & edit . author ) ) ; self . render ( ) ; }
TODO: plugin edits should be represented by real Deltas.
TODO : plugin edits should be represented by real Deltas .
&mut self
edit
&PluginEdit
undo_group
Option<usize>