Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ enum PropertyId {

// LengthSlice
CharacterLengths,
WordLengths,
WordStarts,

// CoordSlice
CharacterPositions,
Expand Down Expand Up @@ -1862,9 +1862,16 @@ length_slice_property_methods! {
/// [`value`]: Node::value
(CharacterLengths, character_lengths, set_character_lengths, clear_character_lengths),

/// For text runs, the length of each word in characters, as defined
/// in [`character_lengths`]. The sum of these lengths must equal
/// the length of [`character_lengths`].
/// For text runs, the start index of each word in characters, as defined
/// in [`character_lengths`]. This list must be sorted.
///
/// If this text run doesn't contain the start of any words, but only
/// the middle or end of a word, this list must be empty.
///
/// If this text run is the first in the document or the first in a paragraph
/// (that is, the previous run ends with a newline character), then the first
/// character of the run is implicitly the start of a word. In this case,
/// beginning this list with `0` is permitted but not necessary.
///
/// The end of each word is the beginning of the next word; there are no
/// characters that are not considered part of a word. Trailing whitespace
Expand All @@ -1884,7 +1891,7 @@ length_slice_property_methods! {
/// word boundaries itself.
///
/// [`character_lengths`]: Node::character_lengths
(WordLengths, word_lengths, set_word_lengths, clear_word_lengths)
(WordStarts, word_starts, set_word_starts, clear_word_starts)
}

coord_slice_property_methods! {
Expand Down Expand Up @@ -2369,7 +2376,7 @@ impl<'de> Visitor<'de> for PropertiesVisitor {
},
LengthSlice {
CharacterLengths,
WordLengths
WordStarts
},
CoordSlice {
CharacterPositions,
Expand Down Expand Up @@ -2516,7 +2523,7 @@ impl JsonSchema for Properties {
},
Box<[u8]> {
CharacterLengths,
WordLengths
WordStarts
},
Box<[f32]> {
CharacterPositions,
Expand Down
5 changes: 2 additions & 3 deletions consumer/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub(crate) struct NodeState {
pub(crate) data: NodeData,
}

#[derive(Copy, Clone)]
#[derive(Copy, Clone, Debug)]
pub struct Node<'a> {
pub tree_state: &'a TreeState,
pub(crate) id: NodeId,
Expand Down Expand Up @@ -1448,7 +1448,6 @@ mod tests {
node.set_character_lengths([]);
node.set_character_positions([]);
node.set_character_widths([]);
node.set_word_lengths([0]);
node.set_text_direction(TextDirection::LeftToRight);
node
}),
Expand Down Expand Up @@ -1516,7 +1515,7 @@ mod tests {
node.set_character_lengths([1]);
node.set_character_positions([0.0]);
node.set_character_widths([8.0]);
node.set_word_lengths([1]);
node.set_word_starts([0]);
node.set_text_direction(TextDirection::LeftToRight);
node
}),
Expand Down
Loading