I have been experiencing an unusual problem in the oh-my-zsh configuration in which the cursor gets out of sync with the text. (I normally work using screen in konsole.

For instance on a new terminal line where nothing has been typed on the prompt, the cursor just shifts forward after a few seconds for no reason. It as though the starting position for the prompt gets shifted forward, like some ghost did it.

The other feature is that it is impossible to backspace to the first cursor position and the character at that position cannot be backspaced over.

The way I see is that the visual position of the cursor and text displayed gets misaligned with its actual position within the physical buffer of the text being edited.

eg. say I enter help at the terminal and after that I use the up arrow key to get the previous command which should be help. Something seems to happen with the result that when I backspace over the help I can only backspace as far the e leaving the h still showing, but physically the whole word help in the physical buffer would have been cleared. So if I want to type help again the screen will display hhelp, but on pressing the enter key the command help will be executed. It wont be hhelp.

It only happens on the root account although I am sure that I am using identical settings for both root and end users.

The end result is that if abcde is showing on the screen and backspace over c I more likely to have backspaced of b, leaving me with acde rather than abde.

Any ideas?


This is additional information related to the comments.

My prompt is %{%f%b%k%}$(build_prompt). It is the same on both regular accounts and root's account. But the problem only occurs in the root account.

  • 1
    This is a simple variation on unix.stackexchange.com/q/197185/5132 .
    – JdeBP
    Commented Dec 27, 2019 at 1:30
  • 1
    Does this answer your question? autocomplete weirdness as a result of ugly hack for zsh prompt Commented Dec 27, 2019 at 1:33
  • My prompt is %{%f%b%k%}$(build_prompt). It is the same on both regular accounts and root's account. But the problem only occurs in the root account.
    – vfclists
    Commented Dec 27, 2019 at 9:21
  • 1
    The %{%f%b%k%} looks correct: it contains just three visual effects escape sequences, properly encapsulated. $(build_prompt) calls a shell function build_prompt to build the rest of the prompt string; this is where the error probably is. You might run the build_prompt function manually (perhaps piping its output to od -t x1z for clarity) and compare the results when you're root vs. as a regular user. It might be some oh-my-zsh feature designed to highlight the fact that you are currently root. Finding the reason will be easier once you know the fault in the build_prompt output.
    – telcoM
    Commented Dec 27, 2019 at 14:38

1 Answer 1


I've had this problem in oh-my-zsh in docker and solved it with the following lines in the Dockerfile:

RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \

If you're running on the host directly, try performing the actions in the RUN step and using export to export the environment variables.

To make the changes permanent, you can put the export statements in your ~/.zshrc.

To test that this works:

print -l -- '+--+' '|\u26A1|' '+--+'

Should display:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .