Thunar doesn't navigate correctly to the root directory on "back"/"previous"

Bug #1776483 reported by ProfYaffle
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Thunar File Manager
Confirmed
Medium
thunar (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Thunar 1.6.15 on Bionic 18.04, kernel 4.15.0-23-generic x86_64. Behaviour seen on earlier Xubuntu versions as well.

To reproduce:

1. Open a Thunar file manager window at a directory containing sub-directories (e.g. a home folder)
2. Open one of the sub-directories in a new tab (right click or middle button) (e.g. ~/sub1)
3. Switch to that tab
4. Navigate to any next-level directory (e.g. ~/sub1/sub2) in that second tab
5. Click the back/previous button (not "up")

What should happen:

You end up back in sub1, which is the root directory of that new tab

What does happen:

You end up back in ~, which is the root directory of the *parent* tab in that window - and you skip over sub1 completely. Any subsequent child tabs will exhibit the same behaviour, i.e. opening another tab on ~/sub1/sub2/sub3, go down one more level and back and you'll end up back at ~.

This appears to be limited to the "previous" function, so it's something stack-related - probably, taking the value off the parent stack instead of a tab-specific stack, if I had to guess. "Up" works as intended.

---

$ lsb_release -rd
Description: Ubuntu 18.04 LTS
Release: 18.04

$ apt-cache policy thunar
thunar:
  Installed: 1.6.15-0ubuntu1
  Candidate: 1.6.15-0ubuntu1
  Version table:
 *** 1.6.15-0ubuntu1 500
        500 http://gb.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
In , Michael-hannema (michael-hannema) wrote :

When opening a directory in a new tab, the history of the previous tab is copied into the new one, but the newly opened directory is not stored in the history.

For example:
* Navigate to root ('File System')
* Navigate to the 'usr' directory
* Navigate to the 'share' directory

The top two entries should now say 'usr' and 'File System'.

* Right click the xfce4 directory and click on 'Open in New Tab'

Note that this new tab has the same history as the old one.

* Navigate to the 'applications' directory

Note that the 'share' directory has now been added to the history, but the 'xfce4' directory has not. When you use the back button at this point, you will indeed end up in /usr/share and not in /usr/share/xfce4.

This odd behaviour does not occur when opening a directory in a new *window*.

Expected behaviour:
* Opening a directory in a new tab should give the new tab a fresh history, as in web browsers with tabs.
* The directory that is opened in the new tab should be recorded in the history of that new tab.

Version info:
I am using version 1.6.10-2 on amd64, as provided by packages of Debian Stretch.

Revision history for this message
In , Hacking-k (hacking-k) wrote :

Another problem, related to this is:

When you follow Michael's steps and, from the 'xfce4' tab, navigate one level
up, the 'xfce4' folder *should* be selected, but it isn't. Also, this is not a
problem when 'xfce4' was opened as a new window.

git-bisect'ing identified

https://git.xfce.org/xfce/thunar/commit/?id=aa5f8fca0e6e965a9592da30c36d2fa4afe44746

as the culprit.

Digging into this revealed actually two problems here:

1) thunar_window_notebook_insert(ThunarWindow *window, ThunarFile *directory)
creates a copy of the history for the new tab to use. For newly created tabs,
these histories are exact copies, lacking a history entry for the directoy of
the original tab itself (this is what Michael already explained).

So the obvious solution would be to just add

thunar_navigator_set_current_directory(THUNAR_NAVIGATOR(history), directory);

after the copied history has been set on the new tab.

HOWEVER:

2) Things get really interesting, when you open multiple new tabs at once, say,
not only 'xfce' but also 'xml' and 'zoneinfo':

Within thunar_window_notebook_insert(...), the call

history = thunar_standard_view_copy_history (THUNAR_STANDARD_VIEW (window->view));

does not copy the history from the "originating tab", but from the most recently active tab.
Since tabs get "activated" from within thunar_window_notebook_insert(), in effect the history

- for the 'xfce' tab initially is a copy of the "original" tab's,

- for 'xml' it's a copy of the 'xfce' tab's,

- for 'zoneinfo' it's a copy of the 'xml' tab's and so on

Due to this, the fix above causes every later opened tab to have a history entry for its predecessor.

I'm not sure how to fix that one...

Cheers
Daniel

ProfYaffle (profyaffle)
description: updated
Changed in thunar:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in thunar (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.