开发者

What are these shell escape characters?

I'm trying out the coffee script repl inside Emacs (under ArchLinux) and I'm seeing these escape characters surrounding the prompt:

[1Gcoffee> [0K[9G

These shouldn't be colors as I already enabled the ansi-color-for-comint-mode. So does anyone recognize these?

P.S.: Funn开发者_运维知识库y thing is I don't have this issue under my Emacs+Cygwin setup!


I don't know where they're coming from (something to do with your shell prompt, obviously, but it's hard to say more than that).

I read them as:

  • ESC[1G - Move to column 1 (Cursor Character Absolute)
  • ESC[0K - Erase to right
  • ESC[9G - Move to column 9

It looks like an attempt by the shell to ensure that the prompt is at the far left of an empty line. Not sure what shell you have, but zsh does something similar when the PROMPT_SP option is enabled. I don't think it uses the above sequences, though.

Many, many, control sequences can be found here. Note that the sequence "ESC[" is interpreted as a "Control Sequence Introducer" (CSI) and is shown as that on that page.


I had the same problem and was able to solve it by adding

export NODE_NO_READLINE=1

to my .bashrc file.

So, the characters appear to have come from the CoffeeScript REPL's use of Readline. Perhaps the reason you didn't have the issue in Cygwin was because Readline wasn't available there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜