fixed insertAtCaret function for foolfuuka theme