I'm not sure if I'm missing some sort of configuration here, but occasionally my cursor is unable to return to beginning of line where command starts. If I press FN+leftArrow, it goes few characters after beginning of command, if I press FN+rightArrow, ot goes way behind end of line. It seems like it thinks that whole line is shifted to the right. See screenshots attached. I was unable to reproduce this on purpose. It happens woth all kind of different commands pretty nondeterministically :-(. Any ideas are welcomed, thanks.
Matthew
Best Answer
So our debugging session has determined it is your prompt customization, not iTerm2. You said your prompt customization is:
The simple answer is don't use
tput
to customize your prompt. It's thesgr0
reset command that's likely doing more than you want it to do and screwing up buffered text movements.Let's try doing this with ANSI codes directly. If you use an ANSI color scheme setup like this you can try:
That works perfectly for me with Fn-arrow combinations for navigating the line.
tput
is a neat idea, but it comes from thencurses
package which is a very advanced way of doing UIs in command prompt interfaces by exploiting all kinds of terminal stuff. Best to just stick to ANSI here.