Skip to content

Commit 82415df

Browse files
committed
docs: fix RichtextState marks encoding and ContainerArena i32 format
1. EncodedMark is postcard Vec (row-wise), not columnar - The marks field in EncodedText lacks #[columnar(class = "vec")] - Only spans has columnar encoding via that attribute 2. ContainerArena key_idx_or_counter uses zigzag varint, not SLEB128 - Row-wise postcard encoding uses zigzag for signed integers
1 parent 07224b6 commit 82415df

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

docs/encoding-container-states.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Richtext container stores text with optional styling marks.
230230
├─────────────────┼──────────────────────────────────────────────────────────┤
231231
│ Vec<String> │ Style keys (postcard Vec<InternalString>) │
232232
├─────────────────┼──────────────────────────────────────────────────────────┤
233-
│ Vec<Mark> │ EncodedMark array (columnar)
233+
│ Vec<Mark> │ EncodedMark array (postcard Vec, row-wise)
234234
└─────────────────┴──────────────────────────────────────────────────────────┘
235235
```
236236

@@ -252,18 +252,18 @@ len interpretation:
252252
- -1: Style mark end
253253
```
254254

255-
### EncodedMark (Columnar)
255+
### EncodedMark (postcard Vec, row-wise)
256256

257257
For each span with `len == 0` (style start), there's a corresponding mark:
258258

259259
```
260260
┌────────────────────────────────────────────────────────────────────────────┐
261-
Column │ Strategy │ Description
262-
├──────────────────────────────────────────────────────────────────────────┤
263-
key_idx │ (raw varint) │ Index into keys array │
264-
value │ (postcard) │ LoroValue for the style
265-
info │ (raw u8) │ TextStyleInfoFlag byte
266-
└─────────────────┴─────────────────────────────────────────────────────────┘
261+
For each EncodedMark (row-wise postcard):
262+
├──────────────────────────────────────────────────────────────────────────┤
263+
varint │ key_idx - Index into keys array
264+
postcard │ value - LoroValue for the style
265+
1 byte │ info - TextStyleInfoFlag byte
266+
└─────────────────┴─────────────────────────────────────────────────────────┘
267267
268268
info byte layout:
269269
Bit 7 (0x80): ALIVE - Style is active

docs/encoding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ ContainerIDs are encoded as a postcard Vec of EncodedContainer structs (row-wise
600600
│ 1 byte │ is_root (bool) │
601601
│ 1 byte │ kind (u8 container type) │
602602
│ LEB128 │ peer_idx (usize) │
603-
SLEB128 │ key_idx_or_counter (i32) │
603+
zigzag varint│ key_idx_or_counter (i32) │
604604
└───────────────┴──────────────────────────────────────────────────┘
605605
606606
For root containers (is_root = true):

0 commit comments

Comments
 (0)