diff options
author | notoria | 2021-06-09 16:07:58 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-10 13:00:08 +0000 |
commit | 1b14e9a19aeba2750bb57d9f97cc12ca3624a21d (patch) | |
tree | 3cd946e461d4dc6d7aedfa8f2ef40b72b3202be5 /helix-core/src | |
parent | e46346c907e9ea42d4966391cae4c211deaa3701 (diff) |
Downgrade `unicode-segmentation`
Diffstat (limited to 'helix-core/src')
-rw-r--r-- | helix-core/src/graphemes.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/helix-core/src/graphemes.rs b/helix-core/src/graphemes.rs index 9844a343..af740f61 100644 --- a/helix-core/src/graphemes.rs +++ b/helix-core/src/graphemes.rs @@ -3,6 +3,8 @@ use ropey::{iter::Chunks, str_utils::byte_to_char_idx, RopeSlice}; use unicode_segmentation::{GraphemeCursor, GraphemeIncomplete}; use unicode_width::UnicodeWidthStr; +use std::fmt; + #[must_use] pub fn grapheme_width(g: &str) -> usize { if g.as_bytes()[0] <= 127 { @@ -147,7 +149,7 @@ pub fn is_grapheme_boundary(slice: RopeSlice, char_idx: usize) -> bool { } /// An iterator over the graphemes of a `RopeSlice`. -#[derive(Debug, Clone)] +#[derive(Clone)] pub struct RopeGraphemes<'a> { text: RopeSlice<'a>, chunks: Chunks<'a>, @@ -156,6 +158,18 @@ pub struct RopeGraphemes<'a> { cursor: GraphemeCursor, } +impl<'a> fmt::Debug for RopeGraphemes<'a> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RopeGraphemes") + .field("text", &self.text) + .field("chunks", &self.chunks) + .field("cur_chunk", &self.cur_chunk) + .field("cur_chunk_start", &self.cur_chunk_start) + // .field("cursor", &self.cursor) + .finish() + } +} + impl<'a> RopeGraphemes<'a> { #[must_use] pub fn new(slice: RopeSlice) -> RopeGraphemes { |