Improve cursor movements around edgecases
Remove trailing comma gt#1289