xtermjs / xterm.js

A terminal for the web
https://xtermjs.org/
MIT License
17.43k stars 1.62k forks source link

kubectl get secret command will always output "%" #4899

Closed swhoro closed 9 months ago

swhoro commented 9 months ago

Details

Steps to reproduce

  1. Input any kubectl get secret command like kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"}
  2. There will be % at the end of output

image

I have tried using tabby and a demo written by myself, both having the same problem.

It seems this is caused by a returned control sequence from ssh server: \u001b[1m\u001b[7m%\u001b[27m\u001b[1m\u001b[0m

If I input a simple command like echo x, there will still be a returned control sequence like above. But in this case, there will not be a percent at the end.

Maybe some parsing logic of xtermjs cause this problem?

jerch commented 9 months ago

Maybe some parsing logic of xtermjs cause this problem?

Nope, this is done by your shell (zsh) to indicate, that the last line of output was not ended by a newline and the shell had to insert a newline itself to align the prompt into the next row. You can repro it with echo -n x and with any other TE as well. To customize the behavior of zsh here check the PROMPT_EOL_MARK setting.