Bug 403690

Summary: new tab should be opened after the current tab in tab list, not at the end
Product: [Applications] dolphin Reporter: vini.ipsmaker
Component: generalAssignee: David Hallas <david>
Status: RESOLVED FIXED    
Severity: wishlist CC: david, elvis.angelaccio, kcohar, nate
Priority: NOR Keywords: junior-jobs
Version: 18.12.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 19.04.0
Sentry Crash Report:

Description vini.ipsmaker 2019-01-28 14:21:48 UTC
STEPS TO REPRODUCE

1. Right-click on folder and choose "open on new tab"
2. Tab should have been opened at the right of current tab in tabs list
3. Tab is opened at the end of tabs list
Comment 1 Nate Graham 2019-02-05 22:09:44 UTC
Seems reasonable.
Comment 2 Krešimir Čohar 2019-02-05 22:22:13 UTC
Are you sure about this though? This breaks convention in a number of ways:

- Konsole seems to behave this way
- Chromium, Firefox and Falkon do too
- Kate opens up new "tabs" (documents) to the left of all its old tabs, not after/to the right of each old tab

There's nothing in the HiG that prevents us from changing this, but I'm not convinced we should - it'll break convention and lead to inconsistencies seeing as the most popular web browsers we all use don't behave this way.
Comment 3 Krešimir Čohar 2019-02-05 22:43:36 UTC
Actually, my bad - they (the browsers) do open up a tab immediately to the right of the focused tab if the tab is opened up by clicking on a link.
If the new tab is empty then it does wind up all the way on the right.

I honestly don't know how I feel about this so I'll just go with whatever the majority decides seeing as not even the web browsers are very consistent when it comes to this.
Comment 4 vini.ipsmaker 2019-02-05 22:57:49 UTC
> Actually, my bad - they (the browsers) do open up a tab immediately to the right of the focused tab if the tab is opened up by clicking on a link.

Yes, that's what I meant. If you right-click a folder and ask to open it up in a new tab, then, the tab should be opened right after the current tab.

If user just press Ctrl + T then the new tab should be opened at the end of the list.

GTK+-based popular file managers such as Nautilus, Thunar and Nemo all behave like I described (although they're getting worse over the years and you guys don't need to exactly mirror everything they do or you too will get a bad end result, but this is pretty much old behaviour anyway).
Comment 5 David Hallas 2019-02-12 10:26:34 UTC
I have pushed a patch for this:

https://phabricator.kde.org/D18945

Please test it out to see if it works as expected :)
Comment 6 vini.ipsmaker 2019-02-13 20:40:13 UTC
> Please test it out to see if it works as expected :)

I'm travelling. Will have time to test it next week. Thanks.
Comment 7 David Hallas 2019-02-16 15:51:54 UTC
Git commit 17af8ae0ad9092e2f64f8fb612ac39d3b078a266 by David Hallas.
Committed on 16/02/2019 at 15:51.
Pushed by hallas into branch 'master'.

New tab should be placed after the current tab

Summary:
When opening a new using the context menu the new tab should be placed
after the currently open tab, not at the end of the tab list.

Test Plan:
Open multiple tabs and select a different tab than the last one.
Open a new tab using the context menu and see that it opens after the currently
selected tab.
Open a tab using Ctrl+T and see that it opens at the end.

Reviewers: #dolphin, ngraham, elvisangelaccio

Reviewed By: #dolphin, ngraham, elvisangelaccio

Subscribers: elvisangelaccio, ngraham, kfm-devel

Tags: #dolphin

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

M  +2    -2    src/dolphinmainwindow.cpp
M  +6    -2    src/dolphintabwidget.cpp
M  +17   -2    src/dolphintabwidget.h

https://commits.kde.org/dolphin/17af8ae0ad9092e2f64f8fb612ac39d3b078a266
Comment 8 vini.ipsmaker 2019-02-20 23:35:50 UTC
> Please test it out to see if it works as expected :)

Almost.

Indeed, opening the folder in a new tab from the context menu will open the folder in the right-hand side of current tab.

However, if I middle-click some folder, it'll be added to the end of the tab list. It should have the same behaviour described in previous paragraph.

Opening a new tab with Ctrl+T will keep the previous behaviour, adding to the end of list. This is the correct behaviour for new unrelated tabs.
Comment 9 David Hallas 2019-02-21 09:37:41 UTC
I didn't know that shortcut ;) But yes I think that makes sense. Is there any other places where you can use middle-clock to open folders in tabs where they are placed wrong?

Nate - do you have any comments on this?
Comment 10 vini.ipsmaker 2019-02-21 09:52:00 UTC
> Is there any other places where you can use middle-clock to open folders in tabs where they are placed wrong?

You mean like clicking on the left panel shortcuts? Yes, this is another place to pay attention.

Or you mean like other shortcuts you missed? I don't think so. There is just this middle-click thing that I'm aware of.
Comment 11 David Hallas 2019-02-21 13:14:44 UTC
(In reply to vini.ipsmaker from comment #10)
> > Is there any other places where you can use middle-clock to open folders in tabs where they are placed wrong?
> 
> You mean like clicking on the left panel shortcuts? Yes, this is another
> place to pay attention.
> 
> Or you mean like other shortcuts you missed? I don't think so. There is just
> this middle-click thing that I'm aware of.

Yes that is what I meant :) So in general we should have a consistent navigation scheme so I just want to make sure that I haven't missed any other places where middle-clicking means opening in another tab and that should put the tab next to the currently open tab.
Comment 12 David Hallas 2019-02-21 13:20:40 UTC
I can see from the code that you can actually middle-click on the back/forward/up buttons in the toolbar to open in a new tab - so should these also open next to the currently open tab?
Comment 13 Nate Graham 2019-02-21 14:10:28 UTC
Yes, I think that would make sense too.
Comment 14 David Hallas 2019-02-21 14:54:04 UTC
I have pushed this commit that should implement all the cases:

https://phabricator.kde.org/D19201

Please test it out and let me know if there is any issues or missing cases.
Comment 15 vini.ipsmaker 2019-02-21 18:40:02 UTC
> I can see from the code that you can actually middle-click on the back/forward/up buttons in the toolbar to open in a new tab - so should these also open next to the currently open tab?

Yes, please.
Comment 16 vini.ipsmaker 2019-02-21 18:55:51 UTC
> https://phabricator.kde.org/D19201

> Please test it out and let me know if there is any issues or missing cases.

I don't know how to get the code.

```
$ git clone git://anongit.kde.org/dolphin
$ cd dolphin
$ git checkout open_new_tab_after_current_tab_middle_click
error: pathspec 'open_new_tab_after_current_tab_middle_click' did not match any file(s) known to git
```

I managed to download the previous code because it hit the master branch, but I'm lost on this phabricator interface.
Comment 18 vini.ipsmaker 2019-02-21 23:51:26 UTC
> https://community.kde.org/Infrastructure/Phabricator#How_to_review_someone_else.27s_patch

Thank you.

> Please test it out and let me know if there is any issues or missing cases.

Perfect. Now my Firefox browsing habits will stay almost unchanged when I use Dolphin. Thank you.
Comment 19 David Hallas 2019-03-09 11:12:08 UTC
Git commit e602e532c0f7c023db097d0eac50a9d7a652b2d1 by David Hallas.
Committed on 09/03/2019 at 11:11.
Pushed by hallas into branch 'master'.

New tab placed after current tab when middle-clicking

Summary:
New tabs should be placed after the currently active tab when using
middle click.

Test Plan:
Open new tab from the places panel using middle click, verify that the
Open new tab from the folders panel using middle click, verify that the
tab is opened after the current tab
Open new tab by middle clicking on the Back button, verify that the tab
is opened after the current tab
Open new tab by middle clicking on the Forward button, verify that the tab
is opened after the current tab

Reviewers: #dolphin, ngraham, elvisangelaccio

Reviewed By: #dolphin, ngraham, elvisangelaccio

Subscribers: kfm-devel

Tags: #dolphin

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

M  +22   -13   src/dolphinmainwindow.cpp
M  +12   -1    src/dolphinmainwindow.h
M  +3    -3    src/views/dolphinview.cpp
M  +2    -1    src/views/dolphinview.h

https://commits.kde.org/dolphin/e602e532c0f7c023db097d0eac50a9d7a652b2d1
Comment 20 David Hallas 2019-03-09 11:13:30 UTC
I have just landed the last commit that implements this behavior in Dolphin. Please test it out and report any issues :)