diff options
Diffstat (limited to 'helix-core/src')
-rw-r--r-- | helix-core/src/history.rs | 12 | ||||
-rw-r--r-- | helix-core/src/selection.rs | 1 | ||||
-rw-r--r-- | helix-core/src/state.rs | 18 | ||||
-rw-r--r-- | helix-core/src/syntax.rs | 2 | ||||
-rw-r--r-- | helix-core/src/transaction.rs | 2 |
5 files changed, 17 insertions, 18 deletions
diff --git a/helix-core/src/history.rs b/helix-core/src/history.rs index 66445525..99de3f7c 100644 --- a/helix-core/src/history.rs +++ b/helix-core/src/history.rs @@ -101,7 +101,7 @@ mod test { // Need to commit before applying! history.commit_revision(&transaction1, &state); transaction1.apply(&mut state); - assert_eq!("hello world!", state.doc()); + assert_eq!("hello world!", state.doc); // --- @@ -111,7 +111,7 @@ mod test { // Need to commit before applying! history.commit_revision(&transaction2, &state); transaction2.apply(&mut state); - assert_eq!("hello 世界!", state.doc()); + assert_eq!("hello 世界!", state.doc); // --- fn undo(history: &mut History, state: &mut State) { @@ -126,15 +126,15 @@ mod test { } undo(&mut history, &mut state); - assert_eq!("hello world!", state.doc()); + assert_eq!("hello world!", state.doc); redo(&mut history, &mut state); - assert_eq!("hello 世界!", state.doc()); + assert_eq!("hello 世界!", state.doc); undo(&mut history, &mut state); undo(&mut history, &mut state); - assert_eq!("hello", state.doc()); + assert_eq!("hello", state.doc); // undo at root is a no-op undo(&mut history, &mut state); - assert_eq!("hello", state.doc()); + assert_eq!("hello", state.doc); } } diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs index edad81a7..ee925cbc 100644 --- a/helix-core/src/selection.rs +++ b/helix-core/src/selection.rs @@ -128,7 +128,6 @@ impl Range { /// A selection consists of one or more selection ranges. #[derive(Debug, Clone)] pub struct Selection { - // TODO: decide how many ranges to inline SmallVec<[Range; 1]> ranges: SmallVec<[Range; 1]>, primary_index: usize, } diff --git a/helix-core/src/state.rs b/helix-core/src/state.rs index 8ff86f0c..b02f9b39 100644 --- a/helix-core/src/state.rs +++ b/helix-core/src/state.rs @@ -27,22 +27,22 @@ impl State { pub fn new(doc: Rope) -> Self { Self { doc, - selection: Selection::single(0, 0), + selection: Selection::point(0), } } // TODO: doc/selection accessors // TODO: be able to take either Rope or RopeSlice - #[inline] - pub fn doc(&self) -> &Rope { - &self.doc - } + // #[inline] + // pub fn doc(&self) -> &Rope { + // &self.doc + // } - #[inline] - pub fn selection(&self) -> &Selection { - &self.selection - } + // #[inline] + // pub fn selection(&self) -> &Selection { + // &self.selection + // } // pub fn doc<R>(&self, range: R) -> RopeSlice // where diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 15fc38c6..54aa78cf 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -1578,7 +1578,7 @@ fn test_input_edits() { let edits = LanguageLayer::generate_edits(state.doc.slice(..), &transaction.changes); transaction.apply(&mut state); - assert_eq!(state.doc(), "fn test(a: u32) {}"); + assert_eq!(state.doc, "fn test(a: u32) {}"); assert_eq!( edits, &[InputEdit { diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs index e12aeebe..bd605305 100644 --- a/helix-core/src/transaction.rs +++ b/helix-core/src/transaction.rs @@ -443,7 +443,7 @@ impl Transaction { /// Generate a transaction that reverts this one. pub fn invert(&self, original: &State) -> Self { - let changes = self.changes.invert(original.doc()); + let changes = self.changes.invert(&original.doc); // Store the current cursor position let selection = original.selection.clone(); |