Add documentation to many core editor types (#7919)

Hopefully this makes it a bit easier for new contributors to dive into
the codebase :)

Release Notes:

- Improved documentation for many core editor types

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
vultix 2024-02-17 10:03:05 -06:00 committed by GitHub
parent f19378135a
commit 8aa5319210
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 138 additions and 5 deletions

View file

@ -3,6 +3,7 @@ use std::{
ops::{Add, AddAssign, Sub},
};
/// A zero-indexed point in a text buffer consisting of a row and column.
#[derive(Clone, Copy, Default, Eq, PartialEq, Debug, Hash)]
pub struct Point {
pub row: u32,

View file

@ -953,15 +953,24 @@ impl sum_tree::Summary for ChunkSummary {
}
}
/// Summary of a string of text.
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct TextSummary {
/// Length in UTF-8
pub len: usize,
/// Length in UTF-16 code units
pub len_utf16: OffsetUtf16,
/// A point representing the number of lines and the length of the last line
pub lines: Point,
/// How many `char`s are in the first line
pub first_line_chars: u32,
/// How many `char`s are in the last line
pub last_line_chars: u32,
/// How many UTF-16 code units are in the last line
pub last_line_len_utf16: u32,
/// The row idx of the longest row
pub longest_row: u32,
/// How many `char`s are in the longest row
pub longest_row_chars: u32,
}