readline reverse search sometimes causes cursor position mismatch
Thanks for filing an issue! Please answer the questions below so I can help you.
- iTerm2 version: 3.2.9
- OS version: Mohave 10.14.5
- Attach ~/Library/Preferences/com.googlecode.iterm2.plist here (drag-drop from finder into this window)
- Attach a debug log, if possible. Instructions at /uploads/debuglog.txt
- Are you reporting a performance issue, excessive CPU usage, or a hang? Please attach a sample. Instructions at https://gitlab.com/gnachman/iterm2/wikis/HowToSample
- Are you reporting a crash? Please attach the crash log. Instructions at https://gitlab.com/gnachman/iterm2/wikis/crash-logs
- Are you reporting excessive memory usage? Please attach a heap analysis: https://gitlab.com/gnachman/iterm2/wikis/heapshot
Detailed steps to reproduce the problem:
1. Set PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]$ "
2. Perform a bash readline reverse search with Esc+r followed by typing some search string
3. Once the desired history line appears, exit the search with Esc+j
4. Hit Esc-a to bring cursor to beginning of line
5. Hit Esc-e to bring cursor to end of line
What happened: Instead of bringing the cursor to the beginning or end of the line, Esc-a brings it to 10 (or some other) characters before the '$' at the end of the prompt. Esc-e brings it to the same 10 (or some other) characters before the end of the line. More generally, the cursor behaves as if it thinks the prompt is that much shorter.
What should have happened: Steps 4 and 5 should work as expected
=========== UPDATE ==============
I changed my prompt using:
$ export PS1="\u@\h:\W$ "
and the problem went away. It would be nice to be able to have colors in the prompt, however.