Repository navigation
Conversation
Cursors, selections and truncation limits counted chars with .chars().count(), then sliced the str with that count as if it were a byte offset, so editing or truncating Chinese, Japanese, Korean or emoji text misplaced the caret or cut mid-character. Cursors and selection columns are now byte offsets kept on grapheme boundaries, previews cut by display width, and character limits are found with a bounded char_indices walk. Slices whose bound could split a character (scheduler output, the context report's section span, the picker's case-insensitive match) now land on boundaries, and the paste threshold is one check shared by the TUI and the prompt block. Closes #1160
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cursors, selection columns and truncation limits counted
chars and then sliced the&strwith that count as a byte offset, so editing or truncating Chinese, Japanese, Korean or emoji text misplaced the caret or cut mid-character. Cursors and selections are now byte offsets on grapheme boundaries (the composer and config editors share thegraphemehelpers), previews cut by display width, and character limits use a boundedchar_indiceswalk; no.chars().count()or.chars().nth()is left outside tests. An audit of computed&strslices fixed the ones whose bound could split a character: scheduler output, the context report's section span (which also panicked on a close tag before its open) and the picker's case-insensitive match against lowercased text. The paste threshold is now one character-based check that the TUI and the prompt block share.Editing, moving, deleting and rendering are tested with Chinese, Japanese, Korean and a modified emoji; the TUI, paste, import, scheduler, artifact, chat and context-report tests pass and clippy is clean with
-D warnings.Closes #1160