on master help sign in
Downgrade `unicode-segmentation`
commit1b14e9a19aeba2750bb57d9f97cc12ca3624a21d authornotoria <notoria@users.noreply.github.com> dateWed 9 Jun 2021, 18:07 (5 years ago) parente46346c
3 files changed+18−9
Cargo.lock+2−7 helix-core/Cargo.toml+1−1 helix-core/src/graphemes.rs+15−1
Cargo.lock+2−7
@@ -266,7 +266,7 @@ dependencies = [
266266 "toml",
267267 "tree-sitter",
268268 "unicode-general-category",
269− "unicode-segmentation 1.7.1 (git+https://github.com/unicode-rs/unicode-segmentation.git)",
269+ "unicode-segmentation",
270270 "unicode-width",
271271]
272272
@@ -332,7 +332,7 @@ dependencies = [
332332 "cassowary",
333333 "crossterm",
334334 "serde",
335− "unicode-segmentation 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
335+ "unicode-segmentation",
336336 "unicode-width",
337337]
338338
@@ -991,11 +991,6 @@ version = "1.7.1"
991991source = "registry+https://github.com/rust-lang/crates.io-index"
992992checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
993993
994−[[package]]
995−name = "unicode-segmentation"
996−version = "1.7.1"
997−source = "git+https://github.com/unicode-rs/unicode-segmentation.git#58d73acf0e92f9806619fa79c3138dd410bca216"
998−
999994[[package]]
1000995name = "unicode-width"
1001996version = "0.1.8"
helix-core/Cargo.toml+1−1
@@ -17,7 +17,7 @@ helix-syntax = { path = "../helix-syntax" }
1717ropey = "1.2"
1818smallvec = "1.4"
1919tendril = "0.4.2"
20−unicode-segmentation = { git = "https://github.com/unicode-rs/unicode-segmentation.git" }
20+unicode-segmentation = "1.7.1"
2121unicode-width = "0.1"
2222unicode-general-category = "0.4.0"
2323# 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};
33use unicode_segmentation::{GraphemeCursor, GraphemeIncomplete};
44use unicode_width::UnicodeWidthStr;
55
6+use std::fmt;
7+
68#[must_use]
79pub fn grapheme_width(g: &str) -> usize {
810 if g.as_bytes()[0] <= 127 {
@@ -147,7 +149,7 @@ pub fn is_grapheme_boundary(slice: RopeSlice, char_idx: usize) -> bool {
147149}
148150
149151/// An iterator over the graphemes of a `RopeSlice`.
150−#[derive(Debug, Clone)]
152+#[derive(Clone)]
151153pub struct RopeGraphemes<'a> {
152154 text: RopeSlice<'a>,
153155 chunks: Chunks<'a>,
@@ -156,6 +158,18 @@ pub struct RopeGraphemes<'a> {
156158 cursor: GraphemeCursor,
157159}
158160
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+
159173impl<'a> RopeGraphemes<'a> {
160174 #[must_use]
161175 pub fn new(slice: RopeSlice) -> RopeGraphemes {