File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -783,7 +783,7 @@ fn collect_new_phrases(intervals: &[Interval], symbols: &[Symbol]) -> Vec<(Vec<S
783783
784784impl BasicEditor for Editor {
785785 fn process_keyevent ( & mut self , key_event : KeyboardEvent ) -> EditorKeyBehavior {
786- debug ! ( "process_keyevent: {:? }" , key_event) ;
786+ debug ! ( "process { }" , key_event) ;
787787 self . shared . estimate . tick ( ) ;
788788 // reset?
789789 self . shared . notice_buffer . clear ( ) ;
Original file line number Diff line number Diff line change 11//! Input handling modules
22
3+ use std:: fmt:: Display ;
4+
35use keycode:: Keycode ;
46use keysym:: Keysym ;
57
@@ -142,6 +144,43 @@ impl KeyboardEvent {
142144 }
143145}
144146
147+ impl Display for KeyboardEvent {
148+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
149+ write ! ( f, "#KeyboardEvent(" ) ?;
150+ write ! ( f, ":code {}" , self . code. 0 ) ?;
151+ write ! ( f, " :ksym {}" , self . ksym. 0 ) ?;
152+ if self . ksym . is_unicode ( ) {
153+ write ! ( f, " :char '{}'" , self . ksym. to_unicode( ) ) ?;
154+ }
155+ if self . state != 0 {
156+ write ! ( f, " :state '" ) ?;
157+ if self . is_state_on ( KeyState :: Control ) {
158+ write ! ( f, "c" ) ?;
159+ }
160+ if self . is_state_on ( KeyState :: Shift ) {
161+ write ! ( f, "s" ) ?;
162+ }
163+ if self . is_state_on ( KeyState :: Alt ) {
164+ write ! ( f, "a" ) ?;
165+ }
166+ if self . is_state_on ( KeyState :: Super ) {
167+ write ! ( f, "S" ) ?;
168+ }
169+ if self . is_state_on ( KeyState :: CapsLock ) {
170+ write ! ( f, "C" ) ?;
171+ }
172+ if self . is_state_on ( KeyState :: NumLock ) {
173+ write ! ( f, "N" ) ?;
174+ }
175+ if self . is_state_on ( KeyState :: Release ) {
176+ write ! ( f, "R" ) ?;
177+ }
178+ }
179+ write ! ( f, ")" ) ?;
180+ Ok ( ( ) )
181+ }
182+ }
183+
145184#[ derive( Clone , Copy , Debug ) ]
146185pub struct KeyboardEventBuilder {
147186 evt : KeyboardEvent ,
You can’t perform that action at this time.
0 commit comments