Correcting line inserting and cursor movement