@@ -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 {