After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 772856 - Ctrl+N forgets current directory
Ctrl+N forgets current directory
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Navigation
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 343672 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-10-13 12:08 UTC by Mantas Mikulėnas (grawity)
Modified: 2016-11-26 15:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
application: Launch new window in the current directory (1.71 KB, patch)
2016-10-13 12:14 UTC, Felipe Borges
none Details | Review
application: Launch new window in the current directory (1.68 KB, patch)
2016-10-15 12:18 UTC, Felipe Borges
none Details | Review
application: use default screen with no active window (1.64 KB, patch)
2016-10-15 14:06 UTC, Ernestas Kulik
committed Details | Review
application: Launch new window in the current directory (1.79 KB, patch)
2016-10-16 12:32 UTC, Felipe Borges
committed Details | Review
application: add “clone-window” action (3.86 KB, patch)
2016-10-16 15:21 UTC, Ernestas Kulik
none Details | Review
application: add “clone-window” action (3.56 KB, patch)
2016-10-17 13:34 UTC, Ernestas Kulik
committed Details | Review
application: open home directory on new window if searching (1.88 KB, patch)
2016-10-25 16:02 UTC, Ernestas Kulik
none Details | Review
application: open home directory on new window if searching (1.83 KB, patch)
2016-10-28 14:33 UTC, Ernestas Kulik
none Details | Review
application: open home directory on new window if searching (1.91 KB, patch)
2016-11-03 11:01 UTC, Ernestas Kulik
committed Details | Review

Description Mantas Mikulėnas (grawity) 2016-10-13 12:08:08 UTC
Once upon a time, Ctrl+N would open a new window in the same directory, similar to how Ctrl+T works. (Also Ctrl+N on Windows Explorer.)

However, that broke around v3.20 – now all windows opened with Ctrl+N start at $HOME instead.

nautilus 3.22.x
Comment 1 Felipe Borges 2016-10-13 12:14:31 UTC
Created attachment 337595 [details] [review]
application: Launch new window in the current directory

When pressing Control+N, Nautilus should open the new window in the
same location as the current open one and fallback to the home
directory otherwise.
Comment 2 Ernestas Kulik 2016-10-14 09:36:36 UTC
(In reply to Mantas Mikulėnas from comment #0)
> However, that broke around v3.20 – now all windows opened with Ctrl+N start
> at $HOME instead.

Are you sure? I have tried 3.14.1 in Jessie and it behaves the same way.
The code also suggests that it has been that way since at least 2012.
Comment 3 Felipe Borges 2016-10-14 10:06:37 UTC
(In reply to Ernestas Kulik from comment #2)
> (In reply to Mantas Mikulėnas from comment #0)
> > However, that broke around v3.20 – now all windows opened with Ctrl+N start
> > at $HOME instead.
> 
> Are you sure? I have tried 3.14.1 in Jessie and it behaves the same way.
> The code also suggests that it has been that way since at least 2012.

I can reproduce the bug in 3.20 and master.
Comment 4 Ernestas Kulik 2016-10-14 10:11:57 UTC
(In reply to Felipe Borges from comment #3)
> (In reply to Ernestas Kulik from comment #2)
> > (In reply to Mantas Mikulėnas from comment #0)
> > > However, that broke around v3.20 – now all windows opened with Ctrl+N start
> > > at $HOME instead.
> > 
> > Are you sure? I have tried 3.14.1 in Jessie and it behaves the same way.
> > The code also suggests that it has been that way since at least 2012.
> 
> I can reproduce the bug in 3.20 and master.

Yes, but that is not what I am asking.
Comment 5 Ernestas Kulik 2016-10-14 20:45:47 UTC
Review of attachment 337595 [details] [review]:

Sure. As discussed over IRC, the action should be split for use from the shell and the application itself (so that the home dir is always opened when opening a new window from the shell).

::: src/nautilus-application.c
@@ +707,2 @@
     GtkApplication *application = user_data;
+    GFile *current_location;

g_autoptr is preferred.
Comment 6 Felipe Borges 2016-10-15 12:18:33 UTC
Created attachment 337755 [details] [review]
application: Launch new window in the current directory

When pressing Control+N, Nautilus should open the new window in the
same location as the current open one and fallback to the home
directory otherwise.
Comment 7 Ernestas Kulik 2016-10-15 14:01:29 UTC
Review of attachment 337755 [details] [review]:

Oops, sorry, missed one thing.

::: src/nautilus-application.c
@@ +708,3 @@
+    g_autoptr (GFile) current_location;
+
+    slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (gtk_application_get_active_window (application)));

This crashes Nautilus when the action is invoked with no active window.
Comment 8 Ernestas Kulik 2016-10-15 14:06:48 UTC
Created attachment 337756 [details] [review]
application: use default screen with no active window

Opening a new window emits critical warnings if no active window is
present in real_open_location_full(). A default screen should be used in
that case instead of trying to get it from the window unconditionally.
Comment 9 Ernestas Kulik 2016-10-15 14:08:42 UTC
Comment on attachment 337756 [details] [review]
application: use default screen with no active window

Attachment 337756 [details] pushed as 301e427 - application: use default screen with no active window
Comment 10 Ernestas Kulik 2016-10-15 14:18:03 UTC
(In reply to Ernestas Kulik from comment #7)
> This crashes Nautilus when the action is invoked with no active window.

It still does. My patch above fixes a warning in a different place.
Comment 11 Felipe Borges 2016-10-16 12:32:35 UTC
Created attachment 337785 [details] [review]
application: Launch new window in the current directory

When pressing Control+N, Nautilus should open the new window in the
same location as the current open one and fallback to the home
directory otherwise.
Comment 12 Ernestas Kulik 2016-10-16 13:13:22 UTC
Review of attachment 337785 [details] [review]:

LGTM
Comment 13 Ernestas Kulik 2016-10-16 13:14:39 UTC
Comment on attachment 337785 [details] [review]
application: Launch new window in the current directory

Attachment 337785 [details] pushed as 43bd93e - application: Launch new window in the current directory
Comment 14 Ernestas Kulik 2016-10-16 15:21:32 UTC
Created attachment 337793 [details] [review]
application: add “clone-window” action

Opening a new window from the shell should open the home directory, as
the intent of the user is not clear and it is thus the safest
assumption (it preserves the old behavior). This requires splitting the
“new-window” action in half: “new-window” for use from the shell and
“clone-window” for use from the application.
Comment 15 Carlos Soriano 2016-10-16 21:17:32 UTC
Review of attachment 337793 [details] [review]:

Ok, thanks!

::: src/nautilus-application.c
@@ +734,3 @@
+    current_view = nautilus_window_slot_get_current_view (active_slot);
+
+    if (nautilus_view_is_searching (current_view))

split this change in a different patch and explain the reasoning of why you think we should not open another search but rather the home directory. In overall I agree with it, so just commit it after splitting it and explaining it.
Comment 16 Carlos Soriano 2016-10-16 21:21:24 UTC
Also I believe you are preparing a new patch for changing the ctrl+N behaviour to clone, right?
Comment 17 Ernestas Kulik 2016-10-17 03:24:55 UTC
(In reply to Carlos Soriano from comment #16)
> Also I believe you are preparing a new patch for changing the ctrl+N
> behaviour to clone, right?

Well, I stuffed it all in a single patch, but I will split this off now as well.
Comment 18 Carlos Soriano 2016-10-17 08:39:48 UTC
(In reply to Ernestas Kulik from comment #17)
> (In reply to Carlos Soriano from comment #16)
> > Also I believe you are preparing a new patch for changing the ctrl+N
> > behaviour to clone, right?
> 
> Well, I stuffed it all in a single patch, but I will split this off now as
> well.

I cannot see it, where in the patch it changed the ctrln shortcut to thr clone window action?
Comment 19 Carlos Soriano 2016-10-17 08:41:53 UTC
ctrln + clone action is fine as a single patch, but the non-searching thing is a different change on behaviour, not related to opening a window with the current location.

(btw bugzilla is the worst on phone :/)
Comment 20 Ernestas Kulik 2016-10-17 13:02:23 UTC
Review of attachment 337793 [details] [review]:

::: src/resources/gtk/menus.ui
@@ +3,3 @@
     <section>
       <item>
+	<attribute name="action">app.clone-window</attribute>

I change the accelerator here. Well, rather, the action associated with it.
Comment 21 Ernestas Kulik 2016-10-17 13:34:43 UTC
Created attachment 337852 [details] [review]
application: add “clone-window” action

Opening a new window from the shell should open the home directory, as
the intent of the user is not clear and it is thus the safest
assumption (it preserves the old behavior). This requires splitting the
“new-window” action in half: “new-window” for use from the shell and
“clone-window” for use from the application.
Comment 22 Ernestas Kulik 2016-10-17 14:04:33 UTC
(In reply to Carlos Soriano from comment #15)
> split this change in a different patch and explain the reasoning of why you
> think we should not open another search but rather the home directory.

The thing is that it crashes, because there is no view to go back to. This is sort of a workaround, but a real fix would be rigging up some sort of deep window copying (in the spirit of a true clone).
Comment 23 Carlos Soriano 2016-10-17 15:39:55 UTC
(In reply to Ernestas Kulik from comment #20)
> Review of attachment 337793 [details] [review] [review]:
> 
> ::: src/resources/gtk/menus.ui
> @@ +3,3 @@
>      <section>
>        <item>
> +	<attribute name="action">app.clone-window</attribute>
> 
> I change the accelerator here. Well, rather, the action associated with it.

oh sorry... just saw it, lacked some context (which I couldn't check on phone), damm bugzilla splinter...
Comment 24 Carlos Soriano 2016-10-24 20:52:09 UTC
(In reply to Ernestas Kulik from comment #22)
> (In reply to Carlos Soriano from comment #15)
> > split this change in a different patch and explain the reasoning of why you
> > think we should not open another search but rather the home directory.
> 
> The thing is that it crashes, because there is no view to go back to. This
> is sort of a workaround, but a real fix would be rigging up some sort of
> deep window copying (in the spirit of a true clone).

oh of course...stupid me. This should be fixed also, making the file name having the original file. But that's a different issue.
Comment 25 Carlos Soriano 2016-10-24 20:52:20 UTC
Review of attachment 337852 [details] [review]:

LGTM thanks!
Comment 26 Ernestas Kulik 2016-10-25 16:02:31 UTC
Created attachment 338422 [details] [review]
application: open home directory on new window if searching

Opening a new window in the search view results in a crash, because the
new window does not have a view for the initial location. That can be
worked around by pointing the new window to the home directory.
Comment 27 Ernestas Kulik 2016-10-28 14:33:36 UTC
Created attachment 338725 [details] [review]
application: open home directory on new window if searching

Opening a new window in the search view results in a crash, because the
new window does not have a view for the initial location. That can be
worked around by pointing the new window to the home directory.
Comment 28 Carlos Soriano 2016-11-03 10:05:29 UTC
Review of attachment 338725 [details] [review]:

::: src/nautilus-application.c
@@ +730,3 @@
     active_window = NAUTILUS_WINDOW (gtk_application_get_active_window (application));
     active_slot = nautilus_window_get_active_slot (active_window);
+    current_view = nautilus_window_slot_get_current_view (active_slot);

What if the view is NULL?
Comment 29 Ernestas Kulik 2016-11-03 11:01:08 UTC
Created attachment 339016 [details] [review]
application: open home directory on new window if searching

Opening a new window in the search view results in a crash, because the
new window does not have a view for the initial location. That can be
worked around by pointing the new window to the home directory.
Comment 30 Carlos Soriano 2016-11-10 12:18:40 UTC
Review of attachment 339016 [details] [review]:

Feel free to commit with that changed if that's the case of your intentions. Thanks!

::: src/nautilus-application.c
@@ +734,1 @@
+    if (current_view != NULL &&

you mean current_view == NULL right?
Comment 31 Ernestas Kulik 2016-11-10 12:21:20 UTC
(In reply to Carlos Soriano from comment #30)
> you mean current_view == NULL right?

Oh my god, yes.
Comment 32 Ernestas Kulik 2016-11-10 19:18:08 UTC
(In reply to Ernestas Kulik from comment #31)
> (In reply to Carlos Soriano from comment #30)
> > you mean current_view == NULL right?
> 
> Oh my god, yes.

Wait, no, I do not. We want the view to not be null if we are checking if it is in search.
Comment 33 Carlos Soriano 2016-11-11 10:13:20 UTC
Review of attachment 339016 [details] [review]:

ay :D :D :D
Comment 34 Carlos Soriano 2016-11-11 10:15:15 UTC
I didn't failed, I did it on purpose to test your skills
Comment 35 Ernestas Kulik 2016-11-11 11:11:29 UTC
Attachment 337852 [details] pushed as 37d6da0 - application: add “clone-window” action
Attachment 339016 [details] pushed as 9106fab - application: open home directory on new window if searching
Comment 36 Felipe Borges 2016-11-26 15:53:33 UTC
*** Bug 343672 has been marked as a duplicate of this bug. ***