Remove the dependency on the class variables _empty_item_index and _cursor_part to make the code easier to follow. If _update_completion is refactored in a similar way these variables can be removed.