fix(backends): make composer glyph strip locale-invariant#370
Open
zachlandes wants to merge 1 commit into
Open
fix(backends): make composer glyph strip locale-invariant#370zachlandes wants to merge 1 commit into
zachlandes wants to merge 1 commit into
Conversation
The composer-state readers stripped a leading prompt glyph with
${stripped#?}, which removes a single byte under a C/POSIX locale and
leaves two stray bytes of the three-byte ❯ behind, so an idle composer
was misread as pending. Match and strip the exact glyph literal instead,
then trim any following whitespace. cmux, herdr, and orca share the
pattern; herdr additionally keeps its › prompt glyph.
Add a colocated LC_ALL=C regression test asserting the idle ghost
placeholder still reads empty, so a refactor back to byte-count stripping
cannot regress silently on C/POSIX-locale hosts.
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.
Problem
The composer-state readers in the cmux, herdr, and orca backends stripped a leading prompt glyph with
${stripped#?}.Under a C/POSIX locale that removes a single byte, leaving two stray bytes of the three-byte
❯behind, so an idle composer (for example the❯ Type a message...ghost placeholder) was misread aspendinginstead ofempty.Fix
Match and strip the exact glyph literal (
${stripped#'❯'}and so on), then trim any following whitespace.Applied to cmux, herdr, and orca, which share the pattern; herdr additionally keeps its
›prompt glyph.Each adapter's existing glyph set is preserved exactly as it stands on current main.
Test
Adds a colocated
LC_ALL=Cregression test that asserts the idle ghost placeholder still readsempty, so a refactor back to byte-count stripping cannot regress silently on C/POSIX-locale hosts.Verified directly: the test fails (
pending) against the old byte-strip and passes (empty) with the fix.shellcheck bin/*.sh bin/backends/*.sh tests/*.shis clean.Context
This bug was surfaced by the no-mistakes test step while validating an unrelated PWD-normalization change; it is split out here as its own single-purpose PR against current main.