Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd ^[[2004h characters with shell and ZSH #3035

Closed
darkfeline opened this issue Sep 14, 2015 · 4 comments
Closed

Odd ^[[2004h characters with shell and ZSH #3035

darkfeline opened this issue Sep 14, 2015 · 4 comments

Comments

@darkfeline
Copy link
Contributor

The new 5.1.1 release of ZSH adds support for bracketed paste. This results in the odd effect of printing the bracketed paste control sequences ^[[2004h and ^[[2004l when running ZSH in shell mode.

I believe comint already supports the necessary escaping and pasting, so bracketed paste is redundant.

Workaround is to disable bracketed paste when inside Emacs, by adding the following to .zshrc:

if [ -n "$INSIDE_EMACS" ]; then
    export EDITOR=emacsclient
    unset zle_bracketed_paste  # This line
fi

This is sort of an upstream bug since ZSH shouldn't be attempting bracketed paste on TERM=dumb, but oh well.

@TheBB
Copy link
Collaborator

TheBB commented Sep 15, 2015

So, what do we do here?

@darkfeline
Copy link
Contributor Author

Forgot to close. I don't think there's anything for Spacemacs to do here unless there are more misbehaving programs that do this on TERM=dumb. I meant to document this in case anyone else ran into it.

@TheBB
Copy link
Collaborator

TheBB commented Sep 15, 2015

Ah, no problem. 👍

@douglas-larocca
Copy link

Thanks for mentioning this despite it being an upstream bug. I've been trying to fix this for weeks!

sio added a commit to sio/bash-complete-partial-path that referenced this issue Oct 26, 2020
Since Debian 11 (bash 5.1) bracketed paste mode is turned on by default.
This leads to wrapping each command output into '\e[?2004l' and '\e[?2004h'
(disable bracketed paste, print to stdout, enable bracketed paste).

Since we trust any stdin input in our test suite, there is no reason to
leave this feature on and to manually process garbled output.

Links:
    http://cirw.in/blog/bracketed-paste
    syl20bnr/spacemacs#3035
sio added a commit to sio/bash-complete-partial-path that referenced this issue Oct 26, 2020
Since Debian 11 (bash 5.1) bracketed paste mode is turned on by default.
This leads to wrapping each command output into '\e[?2004l' and '\e[?2004h'
(disable bracketed paste, print to stdout, enable bracketed paste).

Since we trust any stdin input in our test suite, there is no reason to
leave this feature on and to manually process garbled output.

CI failure:
    https://github.com/sio/bash-complete-partial-path/runs/1303915126

Links:
    http://cirw.in/blog/bracketed-paste
    syl20bnr/spacemacs#3035
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@TheBB @darkfeline @douglas-larocca and others