Bug 378786

Summary: inline rename: scrolling causes rename of wrong file
Product: [Applications] dolphin Reporter: suse
Component: view-engine: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: bughunt, bugseforuns, elvis.angelaccio, linus.kardell, lukasz.wojnilowicz, nate, null
Priority: NOR    
Version: 16.12.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 17.11.90

Description suse 2017-04-14 20:26:53 UTC
I'm using inline rename in dolphin.
When I enter the rename mode with F2, change to name, scroll down and then click somewhere else (this will finish rename mode) then a different (WRONG) file will be renamed.

Steps to reproduce:
1. create a temp folder
2. create some test files with e.g.
   for i in {1..100} ; do echo hello >"File$(printf "%03d" "$i").txt" ; done
3. mark file "File0010.txt"
4. press F2 / choose rename in context menu. (inline rename must be enabled)
5. change file name into "ten" (without exiting rename mode!)
6. scroll down to the end
7. click anywhere else 
=> the file "File0010.txt" remain unchanged, but an other file has been renamed! 
(PS: Step 7: sometimes, but not always, you can hit ENTER as well to reproduce the issue)

expected result: The file "File0010.txt" should be changed.
Comment 1 Elvis Angelaccio 2017-04-14 21:05:04 UTC
Can reproduce, thanks for reporting.
Comment 2 Nate Graham 2017-09-03 16:27:16 UTC
Whoa! That's a weird one. And the actual text field moves as you scroll, weird.
Comment 3 null 2017-11-12 18:38:33 UTC
Possibly related:
bug 331236
bug 383641
Comment 4 null 2017-11-16 13:42:48 UTC
Note the fix in https://phabricator.kde.org/D8822 only hides the underlying issue. See also the new analysis I added to https://bugs.kde.org/show_bug.cgi?id=334533#c7.
Comment 5 Nate Graham 2017-11-19 03:37:10 UTC
Git commit 5bee1889e1682f1e7ffe55e49beaf4544eaf7157 by Nathaniel Graham, on behalf of Andreas Krutzler.
Committed on 19/11/2017 at 03:36.
Pushed by ngraham into branch 'master'.

Fix scrolling during inline renaming causes rename of wrong file

Summary:
Scrolling during inline renaming accepts the renaming now, like if one would hit Return for example. I chose this approach because it seems the easiest way to fix this.
This also fixes the “possible” Ui glitch where the renaming KTextField doesn’t move along with the list item. Possible glitch, because I don’t know if this is intentional, but for me it looks broken.
Fixes T7443

Test Plan:
* Enable "Rename inline" in dolphin settings
* Go to a folder where you have to scroll through items (many files, big zoom,…)
* Start to rename a file (context menu, F2, …)
* Scroll with mouse wheel
* Rename  accepted -> file is renamed

Reviewers: ngraham, rkflx, #dolphin, elvisangelaccio

Reviewed By: ngraham, rkflx, #dolphin, elvisangelaccio

Subscribers: anthonyfieroni, elvisangelaccio, #dolphin

Maniphest Tasks: T7443

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

M  +7    -3    src/kitemviews/kitemlistview.cpp
M  +7    -0    src/kitemviews/kstandarditemlistwidget.cpp
M  +3    -0    src/kitemviews/kstandarditemlistwidget.h

https://commits.kde.org/dolphin/5bee1889e1682f1e7ffe55e49beaf4544eaf7157
Comment 6 Elvis Angelaccio 2017-11-19 10:17:57 UTC
Git commit af27d5735c77c825799c570151a85a230a91e8ed by Elvis Angelaccio, on behalf of Andreas Krutzler.
Committed on 19/11/2017 at 10:17.
Pushed by elvisangelaccio into branch 'Applications/17.12'.

Fix scrolling during inline renaming causes rename of wrong file

Summary:
Scrolling during inline renaming accepts the renaming now, like if one would hit Return for example. I chose this approach because it seems the easiest way to fix this.
This also fixes the “possible” Ui glitch where the renaming KTextField doesn’t move along with the list item. Possible glitch, because I don’t know if this is intentional, but for me it looks broken.
Fixes T7443

Test Plan:
* Enable "Rename inline" in dolphin settings
* Go to a folder where you have to scroll through items (many files, big zoom,…)
* Start to rename a file (context menu, F2, …)
* Scroll with mouse wheel
* Rename  accepted -> file is renamed

Reviewers: ngraham, rkflx, #dolphin, elvisangelaccio

Reviewed By: ngraham, rkflx, #dolphin, elvisangelaccio

Subscribers: anthonyfieroni, elvisangelaccio, #dolphin

Maniphest Tasks: T7443

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

M  +7    -3    src/kitemviews/kitemlistview.cpp
M  +7    -0    src/kitemviews/kstandarditemlistwidget.cpp
M  +3    -0    src/kitemviews/kstandarditemlistwidget.h

https://commits.kde.org/dolphin/af27d5735c77c825799c570151a85a230a91e8ed
Comment 7 Nate Graham 2017-12-12 05:20:14 UTC
*** Bug 387809 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2018-03-29 19:21:40 UTC
*** Bug 389892 has been marked as a duplicate of this bug. ***
Comment 9 David Tonhofer 2018-05-27 15:05:12 UTC
I have Dolphin 17.12.2 and it happened again.

Is it supposed to be fixed in that version?
Comment 10 Elvis Angelaccio 2018-05-27 15:10:53 UTC
(In reply to David Tonhofer from comment #9)
> I have Dolphin 17.12.2 and it happened again.
> 
> Is it supposed to be fixed in that version?

Yes, but we may have missed some corner cases.

See https://bugs.kde.org/show_bug.cgi?id=334533#c7