Apple - iTerm2 cursor doesn't return to line beginning
So our debugging session has determined it is your prompt customization, not iTerm2. You said your prompt customization is:
export PS1="$(tput bold)$(tput setaf 6)\t [\W]$(tput sgr0): "
The simple answer is don't use tput
to customize your prompt. It's the sgr0
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:
export PS1="${normal}${bold_blue}\t [\W]${normal}: "
That works perfectly for me with Fn-arrow combinations for navigating the line.
tput
is a neat idea, but it comes from the ncurses
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.