Merge lp:~jeremywootten/pantheon-files/fix-1380265-implement-Ctrl+l-in-search into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Approved by: Zisu Andrei
Approved revision: 2171
Merged at revision: 2247
Proposed branch: lp:~jeremywootten/pantheon-files/fix-1380265-implement-Ctrl+l-in-search
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 99 lines (+36/-8)
4 files modified
libwidgets/Chrome/BasicBreadcrumbsEntry.vala (+15/-0)
libwidgets/Interfaces/SearchableInterface.vala (+1/-1)
libwidgets/View/LocationBar.vala (+7/-2)
libwidgets/View/SearchResults.vala (+13/-5)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/fix-1380265-implement-Ctrl+l-in-search
Reviewer Review Type Date Requested Status
Zisu Andrei (community) Needs Fixing
Review via email: mp+296488@code.launchpad.net

Commit message

Allow pressing Ctrl+L when in search mode

Description of the change

When in search mode, Ctrl-L should return to navigate mode to be consistent with behaviour when viewing directory.

Pending UX decision, it returns to showing the current directory path.

To post a comment you must log in.
Revision history for this message
Zisu Andrei (matzipan) wrote :

Ctrl-L, I guess, comes from "Location". It doesn't make sense to press it again to go to the folder view. On the other hand. "ESC" seems to be working fine.

review: Disapprove
Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Under what circumstances is it returning to folder view with Ctrl-L? For me it returns to navigate mode. In navigate mode, pressing it again does nothing.

Revision history for this message
Zisu Andrei (matzipan) wrote :

I think I might've confused what the scope of this branch was. Testing it again now.

Revision history for this message
Zisu Andrei (matzipan) wrote :

If I'm in navigate mode and I press Ctrl+L, then the whole text is selected.

If I'm in search mode and I press Ctrl+L, no selection is happening.

review: Needs Fixing
2169. By Jeremy Wootten

Select path after exit search mode with Ctrl-L

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

OK, path now consistently selected after Ctrl-L.

Revision history for this message
Zisu Andrei (matzipan) wrote :

Press ctrl+l, type in a string which is not in the folder: I used "asd", press ctrl+l again, the path will not be set to the location path, but will maintain the string "asd".

review: Needs Fixing
2170. By Jeremy Wootten

Ctrl+L always resets entry to current directory path

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Entry now resets to current directory path (selected) when Ctrl+L is pressed, whether in search, navigate or browse mode.

2171. By Jeremy Wootten

Merge trunk to r2229

Revision history for this message
Zisu Andrei (matzipan) wrote :

I double checked that I actually pulled your changes - I did, but it seems to have not changed anything, so:

Press ctrl+l, type in a string which is not in the folder: I used "asd", press ctrl+l again, the path will not be set to the location path, but will maintain the string "asd".

What is more, if I type in a string which does indeed match a file in the folder, I get the search list, but when I press ctrl+l now, nothing happens.

review: Needs Fixing
Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Strange!? I just tried your steps and it worked fine.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libwidgets/Chrome/BasicBreadcrumbsEntry.vala'
2--- libwidgets/Chrome/BasicBreadcrumbsEntry.vala 2016-04-29 11:47:42 +0000
3+++ libwidgets/Chrome/BasicBreadcrumbsEntry.vala 2016-07-03 13:14:10 +0000
4@@ -178,6 +178,10 @@
5 if (event.is_modifier == 1) {
6 return true;
7 }
8+
9+ var mods = event.state & Gtk.accelerator_get_default_mod_mask ();
10+ bool only_control_pressed = (mods == Gdk.ModifierType.CONTROL_MASK);
11+
12 switch (event.keyval) {
13 case Gdk.Key.KP_Down:
14 case Gdk.Key.Down:
15@@ -192,6 +196,17 @@
16 case Gdk.Key.Escape:
17 activate_path ("");
18 return true;
19+
20+ case Gdk.Key.l:
21+ if (only_control_pressed) {
22+ set_entry_text (current_dir_path);
23+ grab_focus ();
24+ return true;
25+ } else {
26+ break;
27+ }
28+ default:
29+ break;
30 }
31 return base.key_press_event (event);
32 }
33
34=== modified file 'libwidgets/Interfaces/SearchableInterface.vala'
35--- libwidgets/Interfaces/SearchableInterface.vala 2016-05-06 10:36:16 +0000
36+++ libwidgets/Interfaces/SearchableInterface.vala 2016-07-03 13:14:10 +0000
37@@ -22,7 +22,7 @@
38 public signal void file_activated (GLib.File file);
39 public signal void cursor_changed (GLib.File? file);
40 public signal void first_match_found (GLib.File? file);
41- public signal void exit ();
42+ public signal void exit (bool exit_navigate = true);
43
44 public abstract void cancel ();
45 public abstract void search (string txt, GLib.File search_location);
46
47=== modified file 'libwidgets/View/LocationBar.vala'
48--- libwidgets/View/LocationBar.vala 2016-05-15 00:40:54 +0000
49+++ libwidgets/View/LocationBar.vala 2016-07-03 13:14:10 +0000
50@@ -81,13 +81,18 @@
51 private void on_search_results_realize () {
52 (get_toplevel () as Gtk.Window).get_group ().add_window (search_results); /*Is this necessary every popup? */
53 }
54- private void on_search_results_exit () {
55+ private void on_search_results_exit (bool exit_navigate = true) {
56 /* Search result widget ensures it has closed and released grab */
57 bread.reset_im_context ();
58 if (focus_timeout_id > 0) {
59 GLib.Source.remove (focus_timeout_id);
60 }
61- escape ();
62+ if (exit_navigate) {
63+ escape ();
64+ } else {
65+ bread.set_entry_text (bread.get_breadcrumbs_path ());
66+ enter_navigate_mode ();
67+ }
68 }
69
70 protected override bool after_bread_focus_out_event (Gdk.EventFocus event) {
71
72=== modified file 'libwidgets/View/SearchResults.vala'
73--- libwidgets/View/SearchResults.vala 2016-05-15 00:40:54 +0000
74+++ libwidgets/View/SearchResults.vala 2016-07-03 13:14:10 +0000
75@@ -364,11 +364,19 @@
76 bool only_alt_pressed = alt_pressed && ((mods & ~Gdk.ModifierType.MOD1_MASK) == 0);
77
78 if (mods != 0 && !only_shift_pressed) {
79- if (only_control_pressed && event.keyval == Gdk.Key.f) {
80- search_current_directory_only = false;
81- begins_with_only = false;
82- search (search_term, current_root);
83- return true;
84+ if (only_control_pressed) {
85+ if (event.keyval == Gdk.Key.f) {
86+ search_current_directory_only = false;
87+ begins_with_only = false;
88+ search (search_term, current_root);
89+ return true;
90+ } else if (event.keyval == Gdk.Key.l) {
91+ cancel (); /* release any grab */
92+ exit (false); /* Do not exit navigate mode */
93+ return true;
94+ } else {
95+ return parent.key_press_event (event);
96+ }
97 } else if (only_alt_pressed &&
98 event.keyval == Gdk.Key.Return ||
99 event.keyval == Gdk.Key.KP_Enter ||

Subscribers

People subscribed via source and target branches

to all changes: