BUG: 411538
FIXED-IN: 19.12
Details
- Reviewers
elvisangelaccio ngraham - Group Reviewers
Dolphin - Commits
- 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
Before:
The third file gets selected
After:
The first file get selected
ctest
Diff Detail
- Repository
- R318 Dolphin
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Nice. But I'm wondering why we even need the 1 second timeout for the case where the selection is cleared.
Add a KItemListSelectionManager::replaceSelection to avoid sending twice selectionChanged in a row on KItemListController::slotChangeCurrentItem
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.
src/kitemviews/kitemlistselectionmanager.cpp | ||
---|---|---|
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? |
src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp | ||
37–47 | This is an unrelated refactoring that should go in its own commit. Feel free to commit this single change without review. |