Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Backspace in zsh fails to work in quite the strange way

I'm on a fresh Virtualbox install of CentOS 6.4.

After installing zsh 5.0.2 from source using ./configure --prefix=/usr && make && make install and setting it as the shell with chsh -s /usr/bin/zsh, everything is good.

Then some time after, after installing python it seems, it starts acting strange.

  1. Happens with PuTTY and iTerm2 over SSH, does not happen on the raw terminal through Virtualbox.
  2. typing something, then erasing it: rather than removing the char and moving the cursor back, the cursor moves forward.
  3. Typing Ctrl+V then Backspace repeatedly prints out this repeating pattern '^@?'
  4. Running cat from zsh works fine. Prints out '^H' if I type that, backspaces like normal if I type normal backspace.

Surely someone's seen this before and knows exactly what the hell it is.

I'm not positive yet, but it seems that installing oh-my-zsh can fix this. But I really want to know what the specific issue is here.

like image 384
Steven Lu Avatar asked Oct 18 '25 18:10

Steven Lu


2 Answers

OK , I suggest you try

export TERM=xterm

in your .zshrc configuration

the Changing into Zsh caused the bug.

like image 81
ctix Avatar answered Oct 20 '25 07:10

ctix


sigh I knew I solved this before.

It's too damn easy to forget things.

The solution is to compile and apply the proper terminfo data with tic, as I have a custom config with my terminal clients, xterm-256color-italic, that confuses zsh.

There appear to be other ways to configure this stuff too; I basically just need it to be properly set up so italics work everywhere (including in tmux) so hopefully I can figure out how to do this more portably than I am currently.

like image 35
Steven Lu Avatar answered Oct 20 '25 07:10

Steven Lu