Describe the bug
RemoveItem, when called, operates both on the unfiltered list & the filtered list resulting in misleading & inconsistent behaviour.
If index < len(filteredItems) then filteredItems will be updated to remove the item at that index while simultaneously removing the item at the same index in the global list even if the two items do not match.
If index >= len(filteredItems) then the global list will be updated to remove the item at that index while the filtered list is simultaneously not updated, even if the item that was removed is currently visible in the filtered list.
Setup
Please complete the following information along with version numbers, if applicable.
- OS [e.g. Ubuntu, macOS]: MacOS
- Shell [e.g. zsh, fish]: fish
- Terminal Emulator [e.g. kitty, iterm]: iTem
- Terminal Multiplexer [e.g. tmux]: N/A
- Locale [e.g. en_US.UTF-8, zh_CN.UTF-8, etc.]: en_US.UTF-8
To Reproduce
Steps to reproduce the behavior:
- Have a list.
- Filter such that the second item in the global list is the first item in the filtered list
- Call
RemoveItem(0) on the filtered list
- Observe that the filtered list updates to show that the first item in it is removed
- Reset the filter
- The item removed from the filter is present, but item in position 0 is gone
Alternatively:
- Have a list.
- Filter such that the global index of the first item in the filtered list is beyond the length of the filter (e.g. filter is len(1) but item is in index 1 on the global list)
- Call
RemoveItem(globalIndexOfFilteredItem) on the filtered list
- Observe that the filtered list does not update to show that the item has been removed
- Reset the filter
- Observe that the item which was still shown in the filter is no longer present in the global list
Source Code
Please include source code if needed to reproduce the behavior.
Expected behavior
When an item is shown as being removed from the filtered list, the same item should be removed from the global list. Likewise, when an item is removed from the global list, that item should be removed from the filtered list if it is present.
Screenshots
Add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Describe the bug
RemoveItem, when called, operates both on the unfiltered list & the filtered list resulting in misleading & inconsistent behaviour.If
index < len(filteredItems)then filteredItems will be updated to remove the item at that index while simultaneously removing the item at the same index in the global list even if the two items do not match.If
index >= len(filteredItems)then the global list will be updated to remove the item at that index while the filtered list is simultaneously not updated, even if the item that was removed is currently visible in the filtered list.Setup
Please complete the following information along with version numbers, if applicable.
To Reproduce
Steps to reproduce the behavior:
RemoveItem(0)on the filtered listAlternatively:
RemoveItem(globalIndexOfFilteredItem)on the filtered listSource Code
Please include source code if needed to reproduce the behavior.
Expected behavior
When an item is shown as being removed from the filtered list, the same item should be removed from the global list. Likewise, when an item is removed from the global list, that item should be removed from the filtered list if it is present.
Screenshots
Add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.