@@ -108,7 +108,7 @@ impl Editor {
108 let mut stdout = stdout();
108 let mut stdout = stdout();
110 // TODO: inefficient, should feed chunks.iter() to tree_sitter.parse_with(|offset, pos|)
110 // 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();
113 // TODO: cache highlight results
113 // TODO: cache highlight results
114 // TODO: only recalculate when state.doc is actually modified
114 // TODO: only recalculate when state.doc is actually modified
@@ -137,10 +137,10 @@ impl Editor {
137 HighlightEvent::Source { start, end } => {
137 HighlightEvent::Source { start, end } => {
138 // TODO: filter out spans out of viewport for now..
138 // TODO: filter out spans out of viewport for now..
140− let start = state.doc.byte_to_char(start);
140+ let start = state.doc().byte_to_char(start);
141− let end = state.doc.byte_to_char(end);
141+ let end = state.doc().byte_to_char(end);
143− let text = state.doc.slice(start..end);
143+ let text = state.doc().slice(start..end);
145 use helix_core::graphemes::{grapheme_width, RopeGraphemes};
145 use helix_core::graphemes::{grapheme_width, RopeGraphemes};
@@ -225,14 +225,14 @@ impl Editor {
225 self.surface = surface;
225 self.surface = surface;
227 // set cursor shape
227 // set cursor shape
228− match state.mode {
228+ match state.mode() {
229 Mode::Insert => write!(stdout, "\x1B[6 q"),
229 Mode::Insert => write!(stdout, "\x1B[6 q"),
230 Mode::Normal => write!(stdout, "\x1B[2 q"),
230 Mode::Normal => write!(stdout, "\x1B[2 q"),
233 // render the cursor
233 // render the cursor
234− let pos = state.selection.cursor();
234+ let pos = state.selection().cursor();
235− let coords = coords_at_pos(&state.doc.slice(..), pos);
235+ let coords = coords_at_pos(&state.doc().slice(..), pos);
236 execute!(
236 execute!(
238 cursor::MoveTo((coords.1 + 2) as u16, coords.0 as u16)
238 cursor::MoveTo((coords.1 + 2) as u16, coords.0 as u16)
@@ -261,7 +261,7 @@ impl Editor {
262 Some(Ok(Event::Key(event))) => {
262 Some(Ok(Event::Key(event))) => {
263 if let Some(state) = &mut self.state {
263 if let Some(state) = &mut self.state {
264− match state.mode {
264+ match state.mode() {
265 Mode::Insert => {
265 Mode::Insert => {
266 match event {
266 match event {
267 KeyEvent {
267 KeyEvent {