diff options
Diffstat (limited to 'helix-view/src')
-rw-r--r-- | helix-view/src/commands.rs | 14 | ||||
-rw-r--r-- | helix-view/src/theme.rs | 1 | ||||
-rw-r--r-- | helix-view/src/view.rs | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/helix-view/src/commands.rs b/helix-view/src/commands.rs index d611e4f6..bdfa57ec 100644 --- a/helix-view/src/commands.rs +++ b/helix-view/src/commands.rs @@ -42,7 +42,7 @@ pub fn move_line_down(view: &mut View, count: usize) { .move_selection(Direction::Forward, Granularity::Line, count); } -pub fn move_line_end(view: &mut View, count: usize) { +pub fn move_line_end(view: &mut View, _count: usize) { // TODO: use a transaction let lines = selection_lines(&view.state); @@ -64,7 +64,7 @@ pub fn move_line_end(view: &mut View, count: usize) { transaction.apply(&mut view.state); } -pub fn move_line_start(view: &mut View, count: usize) { +pub fn move_line_start(view: &mut View, _count: usize) { let lines = selection_lines(&view.state); let positions = lines @@ -208,24 +208,24 @@ fn selection_lines(state: &State) -> Vec<usize> { .map(|range| state.doc.char_to_line(range.head)) .collect::<Vec<_>>(); - lines.sort(); + lines.sort_unstable(); // sorting by usize so _unstable is preferred lines.dedup(); lines } // I inserts at the start of each line with a selection -pub fn prepend_to_line(view: &mut View, _count: usize) { +pub fn prepend_to_line(view: &mut View, count: usize) { view.state.mode = Mode::Insert; - move_line_start(view, _count); + move_line_start(view, count); } // A inserts at the end of each line with a selection -pub fn append_to_line(view: &mut View, _count: usize) { +pub fn append_to_line(view: &mut View, count: usize) { view.state.mode = Mode::Insert; - move_line_end(view, _count); + move_line_end(view, count); } // o inserts a new line after each line with a selection diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs index d61457d7..4cc399ed 100644 --- a/helix-view/src/theme.rs +++ b/helix-view/src/theme.rs @@ -173,6 +173,7 @@ impl Theme { .unwrap_or_else(|| Style::default().fg(Color::Rgb(0, 0, 255))) } + #[inline] pub fn scopes(&self) -> &[String] { &self.scopes } diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs index 0900b0ca..d96752d0 100644 --- a/helix-view/src/view.rs +++ b/helix-view/src/view.rs @@ -13,11 +13,11 @@ pub struct View { } impl View { - pub fn open(path: PathBuf, size: (u16, u16)) -> Result<View, Error> { + pub fn open(path: PathBuf, size: (u16, u16)) -> Result<Self, Error> { let theme = Theme::default(); let state = State::load(path, theme.scopes())?; - let view = View { + let view = Self { state, first_line: 0, size, // TODO: pass in from term |