Bug 301893

Summary: Inline renaming is inconsistent in what part of filename should be selected/highlighted.
Product: [Applications] dolphin Reporter: Jekyll Wu <adaptee>
Component: generalAssignee: Peter Penz <peter.penz19>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 2.0.95   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 4.9.0
Attachments: The (confusing) highlight after starting inline renaming in compact view.

Description Jekyll Wu 2012-06-14 10:38:23 UTC
If I select "hello.txt" and start inline renaming, only "hello" will be selected/highlighted, which is good. However, If I select "hello.rst" and start inline renaming, the whole "hello.rst" will be selected/highlighted, which is a little inconvenient or annoying. The same goes for "hello.kcrash", "hello.vdi", etc.

I don't know the internal logic of what part should be selected when starting inline renaming, but from average users' perspective, this inconsistency looks more like bug than expected behavior.


Reproducible: Always

Steps to Reproduce:
1. Select "hello.rst" and start inline renaming
Actual Results:  
the whole "hello.rst" is selected/highlighted

Expected Results:  
only "hello" is selected, just like the case of "hello.txt"
Comment 1 Jekyll Wu 2012-06-14 10:50:55 UTC
Created attachment 71824 [details]
The (confusing) highlight after starting inline renaming in compact view.

This screenshot shows one potential problem of inline renaming selecting the whole part of "hello.rst" in compact view. It is not easy to tell from the screenshot that I have started inline renaming, because it could easily give the wrong impression that I just select that file without doing any other operation.
Comment 2 Peter Penz 2012-06-14 19:09:26 UTC
Thanks for the report, I understand but it is not as trivial as it seems to be: In initial versions of Dolphin I just selected everything until to the last point. But this resulted in issues with e.g. *.tar.gz extensions. I changed the strategy to select everything until the first point, but people complained that for e.g. my.picture.january.jpg only "my" gets selected...

So now I use KMimeType::extractKnownExtension(text) to check all known extensions and select only the rest. Probably a fallback to solution #1 (select everything except the last extension) should be done if no known extension is given. What do you think?
Comment 3 Jekyll Wu 2012-06-14 20:09:27 UTC
Thanks for the explanation. I now see the trouble you are facing. 

For me, adding strategy #1 as the fallback strategy seems to be a good enough solution. I'm also fine if you decide to leave this report open for some time to gather more feedback from more users before making the change.
Comment 4 Peter Penz 2012-06-16 20:53:54 UTC
Git commit 6207525f03e9a66f714ca1fe716e8d8772d04927 by Peter Penz.
Committed on 16/06/2012 at 22:51.
Pushed by ppenz into branch 'master'.

Renaming: Don't select unknown extensions

If a file with an unknown extension gets renamed, it is assumed
that the letters after the last point represent the extension and
won't be selected.
FIXED-IN: 4.9.0

M  +8    -1    dolphin/src/kitemviews/kstandarditemlistwidget.cpp

http://commits.kde.org/kde-baseapps/6207525f03e9a66f714ca1fe716e8d8772d04927