@@ -108,7 +108,7 @@ impl Editor {
108108 let mut stdout = stdout();
109109
110110 // TODO: inefficient, should feed chunks.iter() to tree_sitter.parse_with(|offset, pos|)
111− let source_code = state.doc.to_string();
111+ let source_code = state.doc().to_string();
112112
113113 // TODO: cache highlight results
114114 // TODO: only recalculate when state.doc is actually modified
@@ -137,10 +137,10 @@ impl Editor {
137137 HighlightEvent::Source { start, end } => {
138138 // TODO: filter out spans out of viewport for now..
139139
140− let start = state.doc.byte_to_char(start);
141− let end = state.doc.byte_to_char(end);
140+ let start = state.doc().byte_to_char(start);
141+ let end = state.doc().byte_to_char(end);
142142
143− let text = state.doc.slice(start..end);
143+ let text = state.doc().slice(start..end);
144144
145145 use helix_core::graphemes::{grapheme_width, RopeGraphemes};
146146
@@ -225,14 +225,14 @@ impl Editor {
225225 self.surface = surface;
226226
227227 // set cursor shape
228− match state.mode {
228+ match state.mode() {
229229 Mode::Insert => write!(stdout, "\x1B[6 q"),
230230 Mode::Normal => write!(stdout, "\x1B[2 q"),
231231 };
232232
233233 // render the cursor
234− let pos = state.selection.cursor();
235− let coords = coords_at_pos(&state.doc.slice(..), pos);
234+ let pos = state.selection().cursor();
235+ let coords = coords_at_pos(&state.doc().slice(..), pos);
236236 execute!(
237237 stdout,
238238 cursor::MoveTo((coords.1 + 2) as u16, coords.0 as u16)
@@ -261,7 +261,7 @@ impl Editor {
261261 }
262262 Some(Ok(Event::Key(event))) => {
263263 if let Some(state) = &mut self.state {
264− match state.mode {
264+ match state.mode() {
265265 Mode::Insert => {
266266 match event {
267267 KeyEvent {