Expand tabs correctly with multibyte characters

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld
2021-05-20 12:47:08 +02:00
committed by Antonio Scandurra
co-authored by Nathan Sobo
parent c62a679e12
commit 6621b9b552
4 changed files with 120 additions and 98 deletions
+2 -2
View File
@@ -643,11 +643,11 @@ impl Buffer {
self.visible_text.chunks_in_range(start..end)
}
pub fn chars(&self) -> rope::Chars {
pub fn chars(&self) -> impl Iterator<Item = char> + '_ {
self.chars_at(0)
}
pub fn chars_at<T: ToOffset>(&self, position: T) -> rope::Chars {
pub fn chars_at<T: ToOffset>(&self, position: T) -> impl Iterator<Item = char> + '_ {
let offset = position.to_offset(self);
self.visible_text.chars_at(offset)
}