Fix memory leaks
Create test cases for a,A,cw
Fix memory leak
Fix bug: 'cw' at end of line sets cursor position wrong