Weird OS X Terminal Bug: Cursor won't go back to end of line after backtracking
I know this is an old question, but I've been beating my head over this for a few days now and I've finally got it. It turns out the solution is simple: update bash to 4.3. The default bash on Macs (even Yosemite) is 3.2.

Install Homebrew with

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


then do

brew install bash


then change your default shell path (in Terminal Preferences) to

/usr/local/bin/bash


and that's it. Check your bash version with

bash --version


and as an added bonus, you can get mode indicators!

bind 'set show-mode-in-prompt on'


and it will show a + for Insert mode and : for Command mode.