Correctly update caret after insert + improve insertNoScroll()
Based on code from built-in SearchReplace.js
See http://akelpad.sourceforge.net/forum/viewtopic.php?p=23254#23254