Refactor Cursor.NextRuneFunc to be more efficient