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 774361 - F2 pressed a second time should select filename+extension
F2 pressed a second time should select filename+extension
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: File and Folder Operations
3.22.x
Other Linux
: Normal enhancement
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 774436 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-11-13 14:40 UTC by Stef933
Modified: 2017-03-02 11:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rename-file-popover-controller: make F2 toggle between selection modes (5.41 KB, patch)
2017-02-04 15:39 UTC, Ernestas Kulik
none Details | Review
rename-file-popover-controller: make F2 toggle between selection modes (5.45 KB, patch)
2017-02-04 15:45 UTC, Ernestas Kulik
none Details | Review
rename-file-popover-controller: make F2 toggle between selection modes (5.35 KB, patch)
2017-02-04 15:51 UTC, Ernestas Kulik
none Details | Review
rename-file-popover-controller: make F2 toggle between selection modes (5.37 KB, patch)
2017-02-04 16:20 UTC, Ernestas Kulik
none Details | Review
rename-file-popover-controller: make F2 toggle between selection modes (3.35 KB, patch)
2017-02-28 16:11 UTC, Ernestas Kulik
none Details | Review
rename-file-popover-controller: set entry width for all files (3.14 KB, patch)
2017-02-28 16:11 UTC, Ernestas Kulik
none Details | Review
rename-file-popover-controller: set entry width for all files (3.15 KB, patch)
2017-02-28 16:14 UTC, Ernestas Kulik
committed Details | Review
rename-file-popover-controller: make F2 toggle between selection modes (3.35 KB, patch)
2017-03-01 06:50 UTC, Ernestas Kulik
none Details | Review
rename-file-popover-controller: make F2 toggle between selection modes (3.59 KB, patch)
2017-03-01 09:42 UTC, Ernestas Kulik
committed Details | Review

Description Stef933 2016-11-13 14:40:21 UTC
When pressing F2, the popover for renaming appears and the filename is selected, not the dot and not the extension => OK.
When pressing F2 again, nothing happens => I would like it to do a CTRL+A, ie selecting the filename + the dot + the extension.
In fact, I would like it to toggle between the two selection modes: filename only <-> filename.extension.
I miss this behaviour from the previous version in Ubuntu (3.16 I think).
Comment 1 Carlos Soriano 2016-11-14 14:13:21 UTC
Oh I see, I just tested in old nautilus and it's true.
I don't mind putting it back sure.
Comment 2 Ernestas Kulik 2016-11-15 10:34:55 UTC
*** Bug 774436 has been marked as a duplicate of this bug. ***
Comment 3 Ernestas Kulik 2017-02-04 15:39:03 UTC
Created attachment 344931 [details] [review]
rename-file-popover-controller: make F2 toggle between selection modes

In previous versions of Nautilus, F2 used to switch between selecting
the whole filename and selecting the filename up to the extension. This
functionality has been lost in some version. This commit brings the
functionality back.
Comment 4 Ernestas Kulik 2017-02-04 15:41:13 UTC
Review of attachment 344931 [details] [review]:

::: src/nautilus-rename-file-popover-controller.c
@@ +270,3 @@
+                               MIN (MAX (n_chars, RENAME_ENTRY_MIN_CHARS),
+                                    RENAME_ENTRY_MAX_CHARS));
+

I decided to not split this, but, basically, it makes the entry sizing consistent between both files and folders.
Comment 5 Ernestas Kulik 2017-02-04 15:45:08 UTC
Created attachment 344932 [details] [review]
rename-file-popover-controller: make F2 toggle between selection modes

Whoops, forgot to pass the pointer to NAUTILUS_IS_RENAME_FILE_POPOVER_CONTROLLER ().
Comment 6 Ernestas Kulik 2017-02-04 15:51:17 UTC
Created attachment 344933 [details] [review]
rename-file-popover-controller: make F2 toggle between selection modes

My brain cannot parse boolean expressions, it appears.
Comment 7 Ernestas Kulik 2017-02-04 15:52:40 UTC
Comment on attachment 344933 [details] [review]
rename-file-popover-controller: make F2 toggle between selection modes

Sorry for the spam, this is a bit broken.
Comment 8 Ernestas Kulik 2017-02-04 16:20:54 UTC
Created attachment 344939 [details] [review]
rename-file-popover-controller: make F2 toggle between selection modes

In previous versions of Nautilus, F2 used to switch between selecting
the whole filename and selecting the filename up to the extension. This
functionality has been lost in some version. This commit brings the
functionality back.
Comment 9 Carlos Soriano 2017-02-28 14:25:29 UTC
Review of attachment 344939 [details] [review]:

::: src/nautilus-rename-file-popover-controller.c
@@ +42,3 @@
     gint closed_handler_id;
+
+    gboolean select_all;

can we avoid this with checking if the entry is all selected instead?

@@ +265,3 @@
     }
 
+    n_chars = g_utf8_strlen (display_name, -1);

since it's pretty independnet... do you mind to separate it in another patch?
Comment 10 Ernestas Kulik 2017-02-28 14:48:02 UTC
(In reply to Carlos Soriano from comment #9)
> ::: src/nautilus-rename-file-popover-controller.c
> @@ +42,3 @@
>      gint closed_handler_id;
> +
> +    gboolean select_all;
> 
> can we avoid this with checking if the entry is all selected instead?

Good idea, I haven’t considered that.

> since it's pretty independnet... do you mind to separate it in another patch?

Sure.
Comment 11 Ernestas Kulik 2017-02-28 16:11:28 UTC
Created attachment 346914 [details] [review]
rename-file-popover-controller: make F2 toggle between selection modes

In previous versions of Nautilus, F2 used to switch between selecting
the whole filename and selecting the filename up to the extension. This
functionality has been lost in some version. This commit brings the
functionality back.
Comment 12 Ernestas Kulik 2017-02-28 16:11:37 UTC
Created attachment 346915 [details] [review]
rename-file-popover-controller: set entry width for all files

The width for the rename popover entry is set if the file is a regular
file, which does not include folders, resulting in a narrow entry,
despite the name being long. This commit makes the code set the width
regardless of the file type.
Comment 13 Ernestas Kulik 2017-02-28 16:14:49 UTC
Created attachment 346916 [details] [review]
rename-file-popover-controller: set entry width for all files

Didn’t zero-initialize the autofree pointer.
Comment 14 Carlos Soriano 2017-02-28 22:13:24 UTC
Review of attachment 346916 [details] [review]:

+1
Comment 15 Carlos Soriano 2017-02-28 22:14:47 UTC
I just realized you have a src.gnome.org address. I think it's time to request a GNOME membership.
Comment 16 Carlos Soriano 2017-02-28 22:32:33 UTC
Review of attachment 346914 [details] [review]:

Feel free to commit after this: and thanks!

::: src/nautilus-rename-file-popover-controller.c
@@ +139,3 @@
+
+    g_return_val_if_fail (NAUTILUS_IS_RENAME_FILE_POPOVER_CONTROLLER (user_data),
+    NautilusRenameFilePopoverController *self;

this is fine, but we (as in gtk+, glib etc.) don't usually make this checks for signals from the same class, because the type is expected to be right.
You can leave it like this, just pointing out.

@@ +158,3 @@
+                                       &start_pos, &end_pos);
+
+    key_event = (GdkEventKey *)event;

can you add a comment explaining what we are doing here? It looks pretty cryptic otherwise "aaah so this whole function is just to toggle between selecting just the name or the name with extension!"
Comment 17 Ernestas Kulik 2017-03-01 06:50:19 UTC
Created attachment 346952 [details] [review]
rename-file-popover-controller: make F2 toggle between selection modes

In previous versions of Nautilus, F2 used to switch between selecting
the whole filename and selecting the filename up to the extension. This
functionality has been lost in some version. This commit brings the
functionality back.
Comment 18 Ernestas Kulik 2017-03-01 06:51:51 UTC
(In reply to Carlos Soriano from comment #16)
> Review of attachment 346914 [details] [review] [review]:
> 
> Feel free to commit after this: and thanks!

I’ll let the patch stew for a bit, gotta run out.

> ::: src/nautilus-rename-file-popover-controller.c
> @@ +139,3 @@
> +
> +    g_return_val_if_fail (NAUTILUS_IS_RENAME_FILE_POPOVER_CONTROLLER
> (user_data),
> +    NautilusRenameFilePopoverController *self;
> 
> this is fine, but we (as in gtk+, glib etc.) don't usually make this checks
> for signals from the same class, because the type is expected to be right.
> You can leave it like this, just pointing out.

Not sure why I added that. This isn’t public API, no real need to do that.
I sometimes get overly defensive in my code. :)

> @@ +158,3 @@
> +                                       &start_pos, &end_pos);
> +
> +    key_event = (GdkEventKey *)event;
> 
> can you add a comment explaining what we are doing here? It looks pretty
> cryptic otherwise "aaah so this whole function is just to toggle between
> selecting just the name or the name with extension!"
Comment 19 Ernestas Kulik 2017-03-01 09:42:08 UTC
Created attachment 346956 [details] [review]
rename-file-popover-controller: make F2 toggle between selection modes

Would have been nice to actually commit the changes. :D
Comment 20 Ernestas Kulik 2017-03-02 11:33:48 UTC
Attachment 346916 [details] pushed as 9becdca - rename-file-popover-controller: set entry width for all files
Attachment 346956 [details] pushed as b24def9 - rename-file-popover-controller: make F2 toggle between selection modes