Re: PS0 vs. \[ \] followup

Chet Ramey <[email protected]> Thu, 11 Jun 2026 15:24:54 -0400
Newsgroups gmane.comp.shells.bash.bugs
Organization ITS, Case Western Reserve University
Message-ID <[email protected]>
On 6/9/26 6:07 PM, Koichi Murase wrote:

> Yes, we agree that they should simply vanish. We are talking about the
> details of when they should vanish. Actually, the current behavior of
> the devel branch fails to properly remove \x01 and \x02 embedded in a
> command substitution, such as `$(prompt-framework git-status)'. In
> fact, prompt frameworks such as Starship embed \x01 and \x02 in their
> output to change colors and styles in the middle of their output. To
> remove \x01 and \x02 properly, they should be removed at the very last
> step, as we are requesting in the present thread.

Are you saying that bash should remove 0x01 and 0x02 anywhere they appear
in a prompt string, even if they are not added behind the scenes as part
of processing \[ and \] before passing the prompt to readline? Why would
it do that?

> We are talking about the detailed behavior of `what it should be
> doing'. Both removing \[\] from the beginning and removing \x01\0x02
> at the final step satisfy what you seem to request. You haven't
> explained why they should be removed before the `promptvars'
> processing instead of after `promptvars'.

There is no `removing'. They are simply not added if bash can't tell that
the prompt will be passed to readline.


> pre-`promptvars' removal in the current devel branch, but it actually
> only removes the embedded markers halfway. To remove those markers,
> including the ones emitted by command substitutions of a prompt
> framework, one needs to remove them after `promptvars' instead of
> pre-`promptvars' removal.

Same question as above.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc (application/pgp-signature, 203 B)
-----BEGIN PGP SIGNATURE-----

wmMEABEIACMWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCaisLhgUDAAAAAAAKCRC7WGnwZOp0qxgq
AKCX+1qB11DYtDcQgRMoE9MMGu5OhgCgn8mPRpv/5BQffU0MjHaYtL7uPhg=
=4GRp
-----END PGP SIGNATURE-----