pub fn with_text(doc_ctx: DocumentCtx, config: Config,
                     buffer_id: BufferIdentifier,
                     initial_view_id: &ViewIdentifier, text: String) -> Editor {

        let engine = Engine::new(Rope::from(text));
        let buffer = engine.get_head().clone();
        let last_rev_id = engine.get_head_rev_id();

        let editor = Editor {
            text: buffer,
            buffer_id: buffer_id,
            path: None,
            syntax: SyntaxDefinition::default(),
            views: BTreeMap::new(),
            view: View::new(initial_view_id),
            engine: engine,
            last_rev_id: last_rev_id,
            pristine_rev_id: last_rev_id,
            undo_group_id: 1,
            // GC only works on undone edits or prefixes of the visible edits,
            // but initial file loading can create an edit with undo group 0,
            // so we want to collect that as part of the prefix.
            live_undos: vec![0],
            cur_undo: 1,
            undos: BTreeSet::new(),
            gc_undos: BTreeSet::new(),
            last_edit_type: EditType::Other,
            this_edit_type: EditType::Other,
            scroll_to: Some(0),
            styles: Scopes::default(),
            doc_ctx: doc_ctx,
            config: config,
            revs_in_flight: 0,
            sync_store: None,
            last_synced_rev: last_rev_id,
        };
        editor
    }
/// Creates a new `Editor`, loading text into a new buffer.
Creates a new `Editor`, loading text into a new buffer.
Creates a new ` Editor ` loading text into a new buffer .
pub fn with_text(doc_ctx: DocumentCtx, config: Config,
                     buffer_id: BufferIdentifier,
                     initial_view_id: &ViewIdentifier, text: String) -> Editor {
        let engine = Engine::new(Rope::from(text));
        let buffer = engine.get_head().clone();
        let last_rev_id = engine.get_head_rev_id();
        let editor = Editor {
            text: buffer,
            buffer_id: buffer_id,
            path: None,
            syntax: SyntaxDefinition::default(),
            views: BTreeMap::new(),
            view: View::new(initial_view_id),
            engine: engine,
            last_rev_id: last_rev_id,
            pristine_rev_id: last_rev_id,
            undo_group_id: 1,
            // GC only works on undone edits or prefixes of the visible edits,
            // but initial file loading can create an edit with undo group 0,
            // so we want to collect that as part of the prefix.
            live_undos: vec![0],
            cur_undo: 1,
            undos: BTreeSet::new(),
            gc_undos: BTreeSet::new(),
            last_edit_type: EditType::Other,
            this_edit_type: EditType::Other,
            scroll_to: Some(0),
            styles: Scopes::default(),
            doc_ctx: doc_ctx,
            config: config,
            revs_in_flight: 0,
            sync_store: None,
            last_synced_rev: last_rev_id,
        };
        editor
    }
pub fn with_text ( doc_ctx : DocumentCtx , config : Config , buffer_id : BufferIdentifier , initial_view_id : & ViewIdentifier , text : String ) -> Editor { let engine = Engine :: new ( Rope :: from ( text ) ) ; let buffer = engine . get_head ( ) . clone ( ) ; let last_rev_id = engine . get_head_rev_id ( ) ; let editor = Editor { text : buffer , buffer_id : buffer_id , path : None , syntax : SyntaxDefinition :: default ( ) , views : BTreeMap :: new ( ) , view : View :: new ( initial_view_id ) , engine : engine , last_rev_id : last_rev_id , pristine_rev_id : last_rev_id , undo_group_id : 1 , // GC only works on undone edits or prefixes of the visible edits, // but initial file loading can create an edit with undo group 0, // so we want to collect that as part of the prefix. live_undos : vec ! [ 0 ] , cur_undo : 1 , undos : BTreeSet :: new ( ) , gc_undos : BTreeSet :: new ( ) , last_edit_type : EditType :: Other , this_edit_type : EditType :: Other , scroll_to : Some ( 0 ) , styles : Scopes :: default ( ) , doc_ctx : doc_ctx , config : config , revs_in_flight : 0 , sync_store : None , last_synced_rev : last_rev_id , } ; editor }
Creates a new `Editor`, loading text into a new buffer.
Creates a new ` Editor ` loading text into a new buffer .
doc_ctx
DocumentCtx
config
Config
buffer_id
BufferIdentifier
initial_view_id
&ViewIdentifier
text
String