I had a similar problem with a laptop. The cursor would erratically jump to
the beginning of a typed line regardless of the program being used and in
fact would exhibit this behaviour upon boot when the password was to be
entered. The thing that worked for me after failing with setting for the
touch pad, re-installing the keyboard and numerous other things, was to
borrow the wireless desktop keyboard, and transceiver from by desktop
computer and plug that into the laptop when it was turned off.
Immediately upon boot up of the laptop, there was a "clunk" that I had never
heard from the laptop before and the boot proceeded absolutely normally
using the wireless desktop keyboard. I tried various programs and all was
"right with the world." I then disconnected the wireless desktop transceiver
and proceeded to use the laptop's hardware without problem. I then rebooted
and haven't had a problem since.
Ron P