- Group Reviewers
- R318:a5ce798f282b: When the selection is deselected, restart the keyboard search from the beginning
Open a directory with 3 files starting with the same letter.
- Press this letter key twice
- The second file is selected
- Deselect the file with the mouse or using Esc
- Wait 1 second
- Press the same key again
The third file gets selected
The first file get selected
emit changeCurrentItem triggers KItemListController::slotChangeCurrentItem which calls in a row:
m_selectionManager->clearSelection(); m_selectionManager->setSelected(index, 1);
Triggering KItemListSelectionManager::SelectionChanged twice in a row and KItemListKeyboardSearchManager::slotSelectionChanged twice
The first time with : previous.isEmpty(): false current.isEmpty(): true previous.count(): 1 current.count(): 0 # deselect everything
Second time with : previous.isEmpty(): true current.isEmpty(): false previous.count(): 0 current.count(): 1 # select the new element
This caused a bug :
Let's you have three files : e1 e2 e3 in folder.
You type e then e and then e you expect the third file to be selected e3.
Without this check, the first file was selected and all subsequent e typing stays on the same file.
I have changed this to not be needed anymore adding KItemListSelectionManager::replaceSelection
Patch seems to work fine, but the lack of commit message makes it hard to understand where the actual bugfix is. Please simplify the patch as mentioned inline.
|181 ↗||(On Diff #65422)|
Is selectionChanged() being emitted twice part of the bug? Or is this an unrelated refactoring that could go to another commit?
This is an unrelated refactoring that should go in its own commit. Feel free to commit this single change without review.