Downgrade `unicode-segmentation`

pull/221/head
notoria 4 years ago committed by Blaž Hrastnik
parent e46346c907
commit 1b14e9a19a

9
Cargo.lock generated

@ -266,7 +266,7 @@ dependencies = [
"toml", "toml",
"tree-sitter", "tree-sitter",
"unicode-general-category", "unicode-general-category",
"unicode-segmentation 1.7.1 (git+https://github.com/unicode-rs/unicode-segmentation.git)", "unicode-segmentation",
"unicode-width", "unicode-width",
] ]
@ -332,7 +332,7 @@ dependencies = [
"cassowary", "cassowary",
"crossterm", "crossterm",
"serde", "serde",
"unicode-segmentation 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-segmentation",
"unicode-width", "unicode-width",
] ]
@ -991,11 +991,6 @@ version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
[[package]]
name = "unicode-segmentation"
version = "1.7.1"
source = "git+https://github.com/unicode-rs/unicode-segmentation.git#58d73acf0e92f9806619fa79c3138dd410bca216"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.8" version = "0.1.8"

@ -17,7 +17,7 @@ helix-syntax = { path = "../helix-syntax" }
ropey = "1.2" ropey = "1.2"
smallvec = "1.4" smallvec = "1.4"
tendril = "0.4.2" 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-width = "0.1"
unicode-general-category = "0.4.0" unicode-general-category = "0.4.0"
# slab = "0.4.2" # slab = "0.4.2"

@ -3,6 +3,8 @@ use ropey::{iter::Chunks, str_utils::byte_to_char_idx, RopeSlice};
use unicode_segmentation::{GraphemeCursor, GraphemeIncomplete}; use unicode_segmentation::{GraphemeCursor, GraphemeIncomplete};
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
use std::fmt;
#[must_use] #[must_use]
pub fn grapheme_width(g: &str) -> usize { pub fn grapheme_width(g: &str) -> usize {
if g.as_bytes()[0] <= 127 { 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`. /// An iterator over the graphemes of a `RopeSlice`.
#[derive(Debug, Clone)] #[derive(Clone)]
pub struct RopeGraphemes<'a> { pub struct RopeGraphemes<'a> {
text: RopeSlice<'a>, text: RopeSlice<'a>,
chunks: Chunks<'a>, chunks: Chunks<'a>,
@ -156,6 +158,18 @@ pub struct RopeGraphemes<'a> {
cursor: GraphemeCursor, 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> { impl<'a> RopeGraphemes<'a> {
#[must_use] #[must_use]
pub fn new(slice: RopeSlice) -> RopeGraphemes { pub fn new(slice: RopeSlice) -> RopeGraphemes {

Loading…
Cancel
Save