Skip to content

Fix: Delta should be chars count, not bytes len - #244

Merged
adzialocha merged 2 commits into
mainfrom
adz/delta-index-bug
Aug 23, 2026
Merged

Fix: Delta should be chars count, not bytes len#244
adzialocha merged 2 commits into
mainfrom
adz/delta-index-bug

Conversation

@adzialocha

Copy link
Copy Markdown
Member

This fixes a bug where we've converted the Loro text deltas wrongly by using the bytes len of the inserted string instead of the number of characters.

When inserting a non-ASCII character this would lead to a bytes len > 1, scrambling text documents.

@adzialocha adzialocha added the frontend GTK, User Interface, UX, etc. label Aug 21, 2026
@adzialocha
adzialocha force-pushed the adz/delta-index-bug branch 3 times, most recently from fb8e599 to 7f6afbf Compare August 23, 2026 15:22
adzialocha and others added 2 commits August 23, 2026 23:00
This fixes a bug where we've converted the Loro text deltas wrongly by
using the bytes len of the inserted string instead of the number of
characters.

When inserting a non-ASCII character this would lead to a bytes len > 1,
scrambling text documents.

Co-authored-by: niklaswimmer <niklas@viric.eu>
Stay consistent with how GTK names char-based positioning.

Co-authored-by: niklaswimmer <niklas@viric.eu>
@adzialocha
adzialocha force-pushed the adz/delta-index-bug branch from 7f6afbf to 36496dd Compare August 23, 2026 21:03
@adzialocha
adzialocha merged commit 7e17039 into main Aug 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend GTK, User Interface, UX, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant