diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs index 1e36288fb..b5c3cd208 100644 --- a/helix-core/src/selection.rs +++ b/helix-core/src/selection.rs @@ -14,7 +14,7 @@ use crate::{ use helix_parsec::{seq, take_until, Parser}; use helix_stdx::rope::{self, RopeSliceExt}; use smallvec::{smallvec, SmallVec}; -use std::{borrow::Cow, iter, slice}; +use std::{borrow::Cow, fmt::Display, iter, slice}; use tree_sitter::Node; /// A single selection range. @@ -390,9 +390,11 @@ impl Range { pub fn into_byte_range(&self, text: RopeSlice) -> (usize, usize) { (text.char_to_byte(self.from()), text.char_to_byte(self.to())) } +} - pub fn to_string(self) -> String { - format!("({},{})", self.anchor, self.head) +impl Display for Range { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "({},{})", self.anchor, self.head) } } diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index ba9403802..aa21e4d68 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -5,7 +5,7 @@ pub(crate) mod typed; pub use dap::*; use futures_util::FutureExt; use helix_event::status; -use helix_parsec::{sep, seq, take_until, Parser}; +use helix_parsec::{seq, take_until, Parser}; use helix_stdx::{ path::expand_tilde, rope::{self, RopeSliceExt}, @@ -18,7 +18,7 @@ pub use typed::*; use helix_core::{ char_idx_at_visual_offset, chars::char_is_word, - comment, coords_at_pos, + comment, doc_formatter::TextFormat, encoding, find_workspace, graphemes::{self, next_grapheme_boundary, RevRopeGraphemes}, diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 667d6979e..1df89749e 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1,4 +1,3 @@ -use std::borrow::Borrow; use std::fmt::Write; use std::io::BufReader; use std::ops::Deref; @@ -510,7 +509,7 @@ fn parse_mark_register_contents( ")" ); let (_, (_, anchor_str, _, head_str, _)) = range_parser.parse(&s).unwrap(); - let anchor: usize = ::from_str(anchor_str).unwrap().clone(); + let anchor: usize = ::from_str(anchor_str).unwrap(); let head: usize = ::from_str(head_str).unwrap(); Range { anchor, diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index b17f1092d..1708b3b4e 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -680,8 +680,6 @@ pub enum GutterType { Spacer, /// Highlight local changes Diff, - /// Bookmarks - Mark, } impl std::str::FromStr for GutterType { diff --git a/helix-view/src/gutter.rs b/helix-view/src/gutter.rs index 709da856a..36f719f79 100644 --- a/helix-view/src/gutter.rs +++ b/helix-view/src/gutter.rs @@ -32,7 +32,6 @@ impl GutterType { GutterType::LineNumbers => line_numbers(editor, doc, view, theme, is_focused), GutterType::Spacer => padding(editor, doc, view, theme, is_focused), GutterType::Diff => diff(editor, doc, view, theme, is_focused), - GutterType::Mark => mark(editor, doc, view, theme, is_focused), } } @@ -42,7 +41,6 @@ impl GutterType { GutterType::LineNumbers => line_numbers_width(view, doc), GutterType::Spacer => 1, GutterType::Diff => 1, - GutterType::Mark => 1, } } } @@ -88,16 +86,6 @@ pub fn diagnostic<'doc>( ) } -pub fn mark<'doc>( - _editor: &'doc Editor, - doc: &'doc Document, - _view: &View, - theme: &Theme, - _is_focused: bool, -) -> GutterFn<'doc> { - todo!() -} - pub fn diff<'doc>( _editor: &'doc Editor, doc: &'doc Document,