Bug 411538

Summary: Alphabetical selection matching ignores de-select
Product: [Applications] dolphin Reporter: David <david.cortes.rivera>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: elvis.angelaccio, meven29, nate
Priority: NOR    
Version First Reported In: 18.08.0   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 19.12
Sentry Crash Report:

Description David 2019-09-02 19:48:42 UTC
Steps to reproduce:
- Launch Dolphin.
- Create some folder with many files *and* sub-folders inside, having starting with different alphabet letters each (alternatively, go somewhere like /usr/lib/).
- Set the folder sorting settings to put folders first (Control -> Sort By -> Tick “Folders First”).
- Inside said folder, press some keyboard letter that would shift the selection to the middle of the folder by selecting the first *sub-folder* that starts with the letter that was pressed.
- Click anywhere inside the empty space in the folder, so that the sub-folder that was selected with the keypress above will now become de-selected.
- Press some keyboard letter that would select a sub-folder starting with a letter earlier in the alphabet than the one selected two steps above.

Expected behavior: just like it happens in other file managers, alphabetical selection matching should start again from the beginning, thus it should select the first *sub-folder* that starts with the letter that was pressed now.

Actual behavior:  alphabetical selection matching continues from where the previous selection was left (even though it’s no longer selected), so instead of selecting the first sub-folder, it selects the first file (which comes after the folders).

Note that the problem (continuing from where the previous selection left) also happens when there’s only files or only sub-folders and also happens when they are not grouped.
Comment 1 Méven Car 2019-09-03 12:12:05 UTC
To simplify the explanation, what you describe is :

1. Say you have a folder opened in dolphin with three files aFile, bFile, cFile, anotherFile. Sorted alphabeticaly 
2. Type once "b", "bFile" gets selected.
Actual:
2. Type once "a", "anotherFile" gets selected.
Expected:
2. Type once "a", "aFile" gets selected.

This currently implemented on purpose.
Comment 2 David 2019-09-03 16:14:39 UTC
(In reply to Méven Car from comment #1)
> To simplify the explanation, what you describe is :
> 
> 1. Say you have a folder opened in dolphin with three files aFile, bFile,
> cFile, anotherFile. Sorted alphabeticaly 
> 2. Type once "b", "bFile" gets selected.
> Actual:
> 2. Type once "a", "anotherFile" gets selected.
> Expected:
> 2. Type once "a", "aFile" gets selected.
> 
> This currently implemented on purpose.

Yes, but that's not the issue - imagine between steps 1 and 2 you de-select "bFile" and then try to select other files/folders by pressing keys. Or Imagine you have:
abFolder
aFolder
bFolder
aFile

Then press "b" first, then Esc (or click an empty space to de-select), and now press "a".
Comment 3 Méven Car 2019-10-10 07:22:37 UTC
Patch proposal at https://phabricator.kde.org/D23716
Comment 4 Méven Car 2019-10-26 10:53:40 UTC
Git commit a5ce798f282b6cf9e153bba89f9caea0cec37da0 by Méven Car.
Committed on 26/10/2019 at 10:53.
Pushed by meven into branch 'master'.

When the selection is deselected, restart the keyboard search from the beginning

Summary:
FIXED-IN: 19.12

Test Plan:
Open a directory with 3 files starting with the same letter.
1. Press this letter key twice
2. The second file is selected
3. Deselect the file with the mouse or using Esc
4. Wait 1 second
5. Press the same key again

Before:
The third file gets selected

After:
The first file get selected

ctest

Reviewers: #dolphin, elvisangelaccio, ngraham

Reviewed By: #dolphin, elvisangelaccio, ngraham

Subscribers: ngraham, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D23716

M  +2    -0    src/kitemviews/kitemlistcontroller.cpp
M  +16   -3    src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp
M  +3    -0    src/kitemviews/private/kitemlistkeyboardsearchmanager.h
M  +6    -0    src/tests/kitemlistcontrollertest.cpp
M  +11   -4    src/tests/kitemlistkeyboardsearchmanagertest.cpp

https://commits.kde.org/dolphin/a5ce798f282b6cf9e153bba89f9caea0cec37da0