Merge lp:~jeremywootten/pantheon-files/fix-1659353-select-Chinese into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Approved by: Cody Garver
Approved revision: 2460
Merged at revision: 2463
Proposed branch: lp:~jeremywootten/pantheon-files/fix-1659353-select-Chinese
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 73 lines (+28/-9)
2 files modified
libwidgets/Chrome/BasicBreadcrumbsEntry.vala (+13/-4)
src/View/Widgets/AbstractEditableLabel.vala (+15/-5)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/fix-1659353-select-Chinese
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+315755@code.launchpad.net

Commit message

Do not trap Down and Up keys in pathbar; only exit rename with unmodified Enter

Description of the change

This branch stops the BreadcrumbsEntry trapping the unmodified down and up keys as these key is used to move down the list of choices of Chinese/Japanese characters in certain input methods.

It was also noticed that there is a problem with renaming using Chinese/Japanese input methods - pressing Enter when selecting a choice of characters causes rename to end without entering the character. It appears that the input method reacts to the character but does not trap it. To ameliorate this, the editable widget now only ends rename with unmodified Enter, allowing Ctrl-Enter to be used to enter the Chinese/Japanese character, at least when tested using the fcitx/mozc Japanese input method.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libwidgets/Chrome/BasicBreadcrumbsEntry.vala'
--- libwidgets/Chrome/BasicBreadcrumbsEntry.vala 2016-12-26 17:17:11 +0000
+++ libwidgets/Chrome/BasicBreadcrumbsEntry.vala 2017-01-27 11:01:54 +0000
@@ -185,15 +185,24 @@
185 bool only_control_pressed = (mods == Gdk.ModifierType.CONTROL_MASK);185 bool only_control_pressed = (mods == Gdk.ModifierType.CONTROL_MASK);
186186
187 switch (event.keyval) {187 switch (event.keyval) {
188 /* Do not trap unmodified Down and Up keys - used by some input methods */
188 case Gdk.Key.KP_Down:189 case Gdk.Key.KP_Down:
189 case Gdk.Key.Down:190 case Gdk.Key.Down:
190 go_down ();191 if (only_control_pressed) {
191 return true;192 go_down ();
193 return true;
194 }
195
196 break;
192197
193 case Gdk.Key.KP_Up:198 case Gdk.Key.KP_Up:
194 case Gdk.Key.Up:199 case Gdk.Key.Up:
195 go_up ();200 if (only_control_pressed) {
196 return true;201 go_up ();
202 return true;
203 }
204
205 break;
197206
198 case Gdk.Key.Escape:207 case Gdk.Key.Escape:
199 activate_path ("");208 activate_path ("");
200209
=== modified file 'src/View/Widgets/AbstractEditableLabel.vala'
--- src/View/Widgets/AbstractEditableLabel.vala 2016-12-31 19:42:09 +0000
+++ src/View/Widgets/AbstractEditableLabel.vala 2017-01-27 11:01:54 +0000
@@ -36,13 +36,22 @@
36 }36 }
3737
38 public bool on_key_press_event (Gdk.EventKey event) {38 public bool on_key_press_event (Gdk.EventKey event) {
39 bool control_pressed = ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0);39 var mods = event.state & Gtk.accelerator_get_default_mod_mask ();
40 bool only_control_pressed = (mods == Gdk.ModifierType.CONTROL_MASK);
41
40 switch (event.keyval) {42 switch (event.keyval) {
41 case Gdk.Key.Return:43 case Gdk.Key.Return:
42 case Gdk.Key.KP_Enter:44 case Gdk.Key.KP_Enter:
43 editing_canceled = false;45 /* Only end rename with unmodified Enter. This is to allow use of Ctrl-Enter
44 remove_widget (); /* also causes edited signal to be emitted by CellRenderer */46 * to commit Chinese/Japanese characters when using some input methods, without ending rename.
45 return true;47 */
48 if (mods == 0) {
49 editing_canceled = false;
50 remove_widget (); /* also causes edited signal to be emitted by CellRenderer */
51 return true;
52 }
53
54 break;
4655
47 case Gdk.Key.Escape:56 case Gdk.Key.Escape:
48 editing_canceled = true;57 editing_canceled = true;
@@ -50,7 +59,8 @@
50 return true;59 return true;
5160
52 case Gdk.Key.z:61 case Gdk.Key.z:
53 if (control_pressed) {62 /* Undo with Ctrl-Z only */
63 if (only_control_pressed) {
54 set_text (original_name);64 set_text (original_name);
55 return true;65 return true;
56 }66 }

Subscribers

People subscribed via source and target branches

to all changes: