# HG changeset patch
# User Jan Vrany <jan.vrany@fit.cvut.cz>
# Date 1516318265 0
# Thu Jan 18 23:31:05 2018 +0000
# Node ID 031924a79f90e2289fe3e75823ad7bc8466d8e5a
# Parent 3e56a34918b6158a9f00e0681103eb0d03e63399
Issue #176: fix handling of keyboard events when completion view has focus.
When a completion view has a focus, forward all events to
the edit text view except cursor movements (should change
selection in completion list) and enter (should complete).
This should fix problems shown in second video attached to
the ticket, namely it should fix the annoying problem of not
reacting to Escape key.
https://swing.fit.cvut.cz/projects/stx-jv/ticket/176
diff -r 3e56a34918b6 -r 031924a79f90 SmallSense__CompletionController.st
a
|
b
|
|
71 | 71 | "Created: / 18-05-2014 / 11:58:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
72 | 72 | ! |
73 | 73 | |
| 74 | editView |
| 75 | ^ editView |
| 76 | ! |
| 77 | |
74 | 78 | environment |
75 | 79 | ^ support notNil |
76 | 80 | ifTrue:[support environment] |
diff -r 3e56a34918b6 -r 031924a79f90 SmallSense__CompletionView.st
a
|
b
|
|
129 | 129 | "/ Already re-delegated |
130 | 130 | ^ self |
131 | 131 | ]. |
132 | | ^ listView keyPress:key x:x y:y |
| 132 | key == #Escape ifTrue:[ |
| 133 | completionController closeCompletionView. |
| 134 | ^ self |
| 135 | ]. |
| 136 | (key == #CursorDown |
| 137 | or:[ key == #CursorUp |
| 138 | or:[ key == #CursorLeft |
| 139 | or:[ key == #CursorRight |
| 140 | or:[ ((key == #Return) and:[ self hasSelection ])]]]]) ifTrue:[ |
| 141 | listView keyPress:key x:x y:y. |
| 142 | ^ self |
| 143 | ]. |
| 144 | |
| 145 | ^ completionController editView keyPress:key x:x y:y |
133 | 146 | |
134 | 147 | "Created: / 27-09-2013 / 14:05:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
135 | 148 | "Modified: / 31-03-2014 / 22:53:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
136 | | "Modified: / 14-12-2017 / 23:17:22 / jv" |
| 149 | "Modified: / 18-01-2018 / 23:10:58 / jv" |
137 | 150 | ! ! |
138 | 151 | |
139 | 152 | !CompletionView methodsFor:'initialization & release'! |