aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/state.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-09-19 14:16:00 +0000
committerBlaž Hrastnik2020-09-19 14:16:00 +0000
commit48330ddb5f36a1c5f44a636525089a019ce4439d (patch)
tree08f845b11f332757120a64f17b48e3222797df5a /helix-core/src/state.rs
parent1303ffd94ab4fcedc2d1b63107e4ccf6c07d3465 (diff)
Command needs access to view information for certain changes.
Diffstat (limited to 'helix-core/src/state.rs')
-rw-r--r--helix-core/src/state.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/helix-core/src/state.rs b/helix-core/src/state.rs
index 55ac5095..5b5f06c0 100644
--- a/helix-core/src/state.rs
+++ b/helix-core/src/state.rs
@@ -1,5 +1,5 @@
use crate::graphemes::{nth_next_grapheme_boundary, nth_prev_grapheme_boundary, RopeGraphemes};
-use crate::{Position, Rope, RopeSlice, Selection, SelectionRange, Syntax};
+use crate::{Position, Range, Rope, RopeSlice, Selection, Syntax};
use anyhow::Error;
use std::path::PathBuf;
@@ -12,11 +12,12 @@ pub enum Mode {
/// A state represents the current editor state of a single buffer.
pub struct State {
+ // TODO: fields should be private but we need to refactor commands.rs first
/// Path to file on disk.
- pub(crate) path: Option<PathBuf>,
- pub(crate) doc: Rope,
- pub(crate) selection: Selection,
- pub(crate) mode: Mode,
+ pub path: Option<PathBuf>,
+ pub doc: Rope,
+ pub selection: Selection,
+ pub mode: Mode,
//
pub syntax: Option<Syntax>,
@@ -189,7 +190,7 @@ impl State {
// } else {
let pos = self.move_pos(range.head, dir, granularity, count);
// };
- SelectionRange::new(pos, pos)
+ Range::new(pos, pos)
})
}
@@ -201,7 +202,7 @@ impl State {
) -> Selection {
self.selection.transform(|range| {
let pos = self.move_pos(range.head, dir, granularity, count);
- SelectionRange::new(range.anchor, pos)
+ Range::new(range.anchor, pos)
})
}
}