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?
UPDATE:
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.
%{%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 Dec 27 '19 at 09:21%{%f%b%k%}
looks correct: it contains just three visual effects escape sequences, properly encapsulated.$(build_prompt)
calls a shell functionbuild_prompt
to build the rest of the prompt string; this is where the error probably is. You might run thebuild_prompt
function manually (perhaps piping its output tood -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 thebuild_prompt
output. – telcoM Dec 27 '19 at 14:38