question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ZSH: prompt line not wrapping correctly

See original GitHub issue

Details

  • OS version: MacOS Catalina

Steps to reproduce

  • Run the demo, it starts with a bash
  • type a lot of text, note that the prompt line wraps correctly, deleting characters works as expected
  • Press CTRL+C, start zsh
  • type a lot of text, note that the prompt line does not wrap, deleting characters will eventually erase the wrong line

This doesn’t happen in Terminal.app or iTerm. It also does not happen in VSCode 1.39.2

I tried xterm@3.0.0 demo and it also shows this wrong behaviour.

Kapture 2019-11-01 at 14 18 31

Can anyone reproduce?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
mofuxcommented, Nov 5, 2019

Turns out this seems to be somewhat Mac specific. The LC_CTYPE environment variable was not set, which will mess up encoding. Manually setting it to “en_US.UTF-8” or “UTF-8” fixes the problem. VSCode and Terminus both have special handling for this kind of problem:

https://github.com/Eugeny/terminus/blob/3d013195cec7e848e9c4404b090efca6332ab2eb/terminus-terminal/src/services/sessions.service.ts

https://github.com/microsoft/vscode/blob/c58aaab8a1cc22a7139b761166a0d4f37d41e998/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts#L101-L175

I’m closing this as it’s not xterm.js related.

0reactions
mofuxcommented, Nov 7, 2019

@jerch Coming from this problem, your description above (and also what’s in the new encoding guide) exactly replicates what I’ve seen! Thanks for the explanation, it all makes sense now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Long lines wrap problem with zsh terminal
There are "zero width" characters in your prompt that must be flagged as such. None of your COLOR_* strings change the cursor position....
Read more >
iTerm2 - text not wrapping with emoji in zsh prompt
I am making a personal theme for oh-my-zsh! but with my current prompt the text doesn't wrap onto a new line and instead...
Read more >
Bash terminal not wrapping text correctly - linux - Super User
This seems somewhat related: Wrapping the tput output in \[ \] is recommended by the Bash man page. This helps Bash ignore non-printable ......
Read more >
Known Issues - Warp Documentation
The native Prompt does not support multi-line at this time and does not support right sided prompts. Improving the native Prompt is on...
Read more >
Zsh and Fish's simple but clever trick for highlighting missing ...
For example, some terminals will wrap to the next line if you are at ... It's actually not overwritten by the prompt but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found