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

Proposed by Jeremy Wootten on 2017-01-27
Status: Merged
Approved by: Cody Garver on 2017-01-28
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 2017-01-27 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
1=== modified file 'libwidgets/Chrome/BasicBreadcrumbsEntry.vala'
2--- libwidgets/Chrome/BasicBreadcrumbsEntry.vala 2016-12-26 17:17:11 +0000
3+++ libwidgets/Chrome/BasicBreadcrumbsEntry.vala 2017-01-27 11:01:54 +0000
4@@ -185,15 +185,24 @@
5 bool only_control_pressed = (mods == Gdk.ModifierType.CONTROL_MASK);
6
7 switch (event.keyval) {
8+ /* Do not trap unmodified Down and Up keys - used by some input methods */
9 case Gdk.Key.KP_Down:
10 case Gdk.Key.Down:
11- go_down ();
12- return true;
13+ if (only_control_pressed) {
14+ go_down ();
15+ return true;
16+ }
17+
18+ break;
19
20 case Gdk.Key.KP_Up:
21 case Gdk.Key.Up:
22- go_up ();
23- return true;
24+ if (only_control_pressed) {
25+ go_up ();
26+ return true;
27+ }
28+
29+ break;
30
31 case Gdk.Key.Escape:
32 activate_path ("");
33
34=== modified file 'src/View/Widgets/AbstractEditableLabel.vala'
35--- src/View/Widgets/AbstractEditableLabel.vala 2016-12-31 19:42:09 +0000
36+++ src/View/Widgets/AbstractEditableLabel.vala 2017-01-27 11:01:54 +0000
37@@ -36,13 +36,22 @@
38 }
39
40 public bool on_key_press_event (Gdk.EventKey event) {
41- bool control_pressed = ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0);
42+ var mods = event.state & Gtk.accelerator_get_default_mod_mask ();
43+ bool only_control_pressed = (mods == Gdk.ModifierType.CONTROL_MASK);
44+
45 switch (event.keyval) {
46 case Gdk.Key.Return:
47 case Gdk.Key.KP_Enter:
48- editing_canceled = false;
49- remove_widget (); /* also causes edited signal to be emitted by CellRenderer */
50- return true;
51+ /* Only end rename with unmodified Enter. This is to allow use of Ctrl-Enter
52+ * to commit Chinese/Japanese characters when using some input methods, without ending rename.
53+ */
54+ if (mods == 0) {
55+ editing_canceled = false;
56+ remove_widget (); /* also causes edited signal to be emitted by CellRenderer */
57+ return true;
58+ }
59+
60+ break;
61
62 case Gdk.Key.Escape:
63 editing_canceled = true;
64@@ -50,7 +59,8 @@
65 return true;
66
67 case Gdk.Key.z:
68- if (control_pressed) {
69+ /* Undo with Ctrl-Z only */
70+ if (only_control_pressed) {
71 set_text (original_name);
72 return true;
73 }

Subscribers

People subscribed via source and target branches

to all changes: