Hide Forgot
Description of problem: I am using a prompt with some colour characters, like: PROMPT=$'\e[0;32muser@host:\e[0;34m%/+ \e[0m' which uses escape sequences to display green and blue colours. However, if I press tab to complete files, the cursor position is moved to the right, like: user@host:/tmp+ ls file ls file file1 file2 The first "ls file" is what I typed, while the second one appears when I press tab. It seems that the sequence characters are also counted to place the cursor after completion. Related to that is the breaking of long lines before one reaches the rightmost end of the terminal. That makes also very annoying to recover commands from the history longer than the terminal width. How reproducible: Always
1. Don't use \e directly, use %F{red} and %K{blue} etc. 2. Use %{\e[0;32m%}blah ... which tells the prompt that the characters are zero width (also see the docs. for %G.
Option 2. worked perfectly. It is a pleasure to see a promptly and accurate response. Thank you!