1

When I type a long command on a command-line interface. Something strange may happen in the layout. The characters I typed don't show in lines correctly. Instead, they merge into 1 line or overwrite each other. And the cursor isn't displayed in its right place. For example:
I want to type:

/home/user/example/a/b/c>$ tar --create --file example.tar e  
xample  

But it shows:

xampleuser/example/a/b/c>$ tar --create --file example.tar e  

As shown above, the second line overwrite the first line.
This problem happens in Linux on different computers. I've met similiar problems both in tty and GUI terminal emulator. It's only a problem in the display, because what I type is exactly what I enter, although it may not be what is shown.
I use American keyboard. The encoding and keymap settings are all the default ones. The keyboard is fine.
More details:

  • font: terminus-132n(tty), terminus 24pt(GUI terminal emulator)
  • OS: Linux 5.18.15-arch1-1
  • $LANG: en_US.UTF-8

1 Answers1

1

Try this...

Enter this command:

export PS1="$PWD>"

Then try a long command and see if the behavior changes. If it does, there's most likely a problem with the PS1 definition in your profile. When customizing PS1 try not to get too fancy, and avoid special characters and control codes if at all possible.

muru
  • 72,889
mikem
  • 845
  • If it's bash, they most likely forgot to put non-printing characters between \[ and \]. Or, they put escape-sequences anywhere but within %{ ... %} in the zsh shell's prompt. – Kusalananda Aug 02 '22 at 06:44
  • Agreed, but to determine that, my suggestion is to make PS1 very simple and see if the behavior changes. – mikem Aug 02 '22 at 07:11