Skip to content

Commit

Permalink
Downgrade unicode-segmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
notoria authored and archseer committed Jun 10, 2021
1 parent e46346c commit 1b14e9a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
9 changes: 2 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion helix-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ helix-syntax = { path = "../helix-syntax" }
ropey = "1.2"
smallvec = "1.4"
tendril = "0.4.2"
unicode-segmentation = { git = "https://github.com/unicode-rs/unicode-segmentation.git" }
unicode-segmentation = "1.7.1"
unicode-width = "0.1"
unicode-general-category = "0.4.0"
# slab = "0.4.2"
Expand Down
16 changes: 15 additions & 1 deletion helix-core/src/graphemes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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>,
Expand All @@ -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 {
Expand Down

0 comments on commit 1b14e9a

Please sign in to comment.