Merge develop into main for v0.1.18 release#12
Merged
Merged
Conversation
…loses #6) Shells send --cursor in their own native unit: bash/zsh/clink/nu count Unicode scalar values (= chars); pwsh counts UTF-16 code units. The Rust hook used the raw value as a byte offset, which agreed by accident on ASCII but split mid-character on Japanese, emoji, or any non-ASCII input. Reporter's PoC reproduced on real WSL bash: typing `ls ./おはよう ./test1`, moving cursor between `う` and the space, pressing Space repeatedly grew a misplaced gap between `は` and `よ` instead of accumulating after `う`. The same misalignment silently corrupted any expansion that ran against a multi-byte buffer in any shell. Fix: - cmd::hook converts the incoming cursor to a byte offset once at the cmd/app boundary via app::hook::shell_cursor_to_byte (char_cursor_to_byte for bash/zsh/clink/nu, utf16_cursor_to_byte for pwsh). - app::hook::render wraps the domain renderer and converts back on the way out (byte_cursor_to_char or byte_cursor_to_utf16). zsh is excluded because its renderer splits LBUFFER/RBUFFER by byte and the cursor number never reaches zsh. - pwsh's UTF-16 path handles surrogate pairs (emoji = 1 char / 4 bytes / 2 UTF-16 code units), rounding mid-surrogate down to the previous boundary. Bake-mode bash dispatcher (0.1.17, Git Bash) is unaffected — pure- bash slicing is char-based. Tidy First (same PR): cmd::hook's three short-circuit paths (oversize line, paste pending, config load failure) shared a five- line "insert space at cursor" shape. Collapsed onto app::hook::insert_space_action. Tests: - 28 new unit tests in app::hook (four conversion helpers × ASCII / Japanese (3-byte BMP) / emoji (4-byte / 2 UTF-16 units) / combining / RTL / NUL / empty / past-end clamping / round-trip property against inverses). - 7 new e2e tests in tests/cli_integration.rs::hook_* driving `runex hook --shell <s>` for each shell with a multi-byte buffer. - Manual verify on WSL bash with 0.1.18: reporter's PoC no longer reproduces. Bump version 0.1.17 → 0.1.18 + CHANGELOG. Closes #6.
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.
Summary
Release 0.1.18 ships the Issue #6 multi-byte cursor fix.
runex hookcursor mismatch (PR fix(hook): convert shell-native cursor unit to byte at the boundary (closes #6) #11). Shells send--cursorin their own native unit — bash/zsh/clink/nu count chars, pwsh counts UTF-16 code units. The Rust hook treated it as a byte offset, splitting mid-character on any non-ASCII input. PoC: typingls ./おはよう ./test1, moving cursor betweenうand the space, pressing Space repeatedly grew a misplaced gap betweenはandよ. Fixed by converting the cursor exactly once at the cmd/app boundary (app::hook::shell_cursor_to_byte) and back to the shell's native unit on the way out (app::hook::render). pwsh's UTF-16 path handles surrogate pairs (emoji = 2 code units).Tests
app::hookfor the four conversion helperstests/cli_integration.rs(5 shells × multi-byte)Test plan
v0.1.18push triggersrelease.yml(crates.io publish + GitHub Release)runex-binbump (helper script)runexsource bump (helper script)Closes #6.