Handle cursor_end < cursor_pos
Fix syntax error