on master help sign in
Downgrade `unicode-segmentation`
1b14e9anotoria
Cargo.lock+2−7
@@ -266,7 +266,7 @@ dependencies = [
266 "toml",
266 "toml",
267 "tree-sitter",
267 "tree-sitter",
268 "unicode-general-category",
268 "unicode-general-category",
269− "unicode-segmentation 1.7.1 (git+https://github.com/unicode-rs/unicode-segmentation.git)",
269+ "unicode-segmentation",
270 "unicode-width",
270 "unicode-width",
271]
271]
272
272
@@ -332,7 +332,7 @@ dependencies = [
332 "cassowary",
332 "cassowary",
333 "crossterm",
333 "crossterm",
334 "serde",
334 "serde",
335− "unicode-segmentation 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
335+ "unicode-segmentation",
336 "unicode-width",
336 "unicode-width",
337]
337]
338
338
@@ -991,11 +991,6 @@ version = "1.7.1"
991source = "registry+https://github.com/rust-lang/crates.io-index"
991source = "registry+https://github.com/rust-lang/crates.io-index"
992checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
992checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
993
993
994−[[package]]
995−name = "unicode-segmentation"
996−version = "1.7.1"
997−source = "git+https://github.com/unicode-rs/unicode-segmentation.git#58d73acf0e92f9806619fa79c3138dd410bca216"
998−
999[[package]]
994[[package]]
1000name = "unicode-width"
995name = "unicode-width"
1001version = "0.1.8"
996version = "0.1.8"
helix-core/Cargo.toml+1−1
@@ -17,7 +17,7 @@ helix-syntax = { path = "../helix-syntax" }
17ropey = "1.2"
17ropey = "1.2"
18smallvec = "1.4"
18smallvec = "1.4"
19tendril = "0.4.2"
19tendril = "0.4.2"
20−unicode-segmentation = { git = "https://github.com/unicode-rs/unicode-segmentation.git" }
20+unicode-segmentation = "1.7.1"
21unicode-width = "0.1"
21unicode-width = "0.1"
22unicode-general-category = "0.4.0"
22unicode-general-category = "0.4.0"
23# slab = "0.4.2"
23# slab = "0.4.2"
helix-core/src/graphemes.rs+15−1
@@ -3,6 +3,8 @@ use ropey::{iter::Chunks, str_utils::byte_to_char_idx, RopeSlice};
3use unicode_segmentation::{GraphemeCursor, GraphemeIncomplete};
3use unicode_segmentation::{GraphemeCursor, GraphemeIncomplete};
4use unicode_width::UnicodeWidthStr;
4use unicode_width::UnicodeWidthStr;
5
5
6+use std::fmt;
7+
6#[must_use]
8#[must_use]
7pub fn grapheme_width(g: &str) -> usize {
9pub fn grapheme_width(g: &str) -> usize {
8 if g.as_bytes()[0] <= 127 {
10 if g.as_bytes()[0] <= 127 {
@@ -147,7 +149,7 @@ pub fn is_grapheme_boundary(slice: RopeSlice, char_idx: usize) -> bool {
147}
149}
148
150
149/// An iterator over the graphemes of a `RopeSlice`.
151/// An iterator over the graphemes of a `RopeSlice`.
150−#[derive(Debug, Clone)]
152+#[derive(Clone)]
151pub struct RopeGraphemes<'a> {
153pub struct RopeGraphemes<'a> {
152 text: RopeSlice<'a>,
154 text: RopeSlice<'a>,
153 chunks: Chunks<'a>,
155 chunks: Chunks<'a>,
@@ -156,6 +158,18 @@ pub struct RopeGraphemes<'a> {
156 cursor: GraphemeCursor,
158 cursor: GraphemeCursor,
157}
159}
158
160
161+impl<'a> fmt::Debug for RopeGraphemes<'a> {
162+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
163+ f.debug_struct("RopeGraphemes")
164+ .field("text", &self.text)
165+ .field("chunks", &self.chunks)
166+ .field("cur_chunk", &self.cur_chunk)
167+ .field("cur_chunk_start", &self.cur_chunk_start)
168+ // .field("cursor", &self.cursor)
169+ .finish()
170+ }
171+}
172+
159impl<'a> RopeGraphemes<'a> {
173impl<'a> RopeGraphemes<'a> {
160 #[must_use]
174 #[must_use]
161 pub fn new(slice: RopeSlice) -> RopeGraphemes {
175 pub fn new(slice: RopeSlice) -> RopeGraphemes {