fixed it here: http://jsfiddle.net/eMwKd/4/
only downside is that the already provided function getCaret() resolves to the wrong position on key down. therefor the red cursor seems to be behind the real cursor unless you release the key.
I will have another look into it.
update: hm, word-wrapping is not accurate if lines too long..