|
4 | 4 | crossterm::{
|
5 | 5 | cursor,
|
6 | 6 | event::{
|
7 |
| - Event, KeyCode, KeyEvent, KeyModifiers, MouseButton, MouseEvent, MouseEventKind, |
| 7 | + Event, |
| 8 | + KeyCode, |
| 9 | + KeyEvent, |
| 10 | + KeyModifiers, |
| 11 | + MouseButton, |
| 12 | + MouseEvent, |
| 13 | + MouseEventKind, |
8 | 14 | },
|
9 | 15 | queue,
|
10 |
| - style::{Attribute, Color, SetBackgroundColor}, |
| 16 | + style::{ |
| 17 | + Attribute, |
| 18 | + Color, |
| 19 | + SetBackgroundColor, |
| 20 | + }, |
11 | 21 | },
|
12 | 22 | *,
|
13 | 23 | },
|
14 |
| - crokey::{key, KeyCombination, OneToThree}, |
| 24 | + crokey::{OneToThree, KeyCombination, key}, |
15 | 25 | std::io::Write,
|
16 | 26 | };
|
17 | 27 |
|
@@ -59,7 +69,7 @@ macro_rules! wrap_content_fun {
|
59 | 69 |
|
60 | 70 | impl InputField {
|
61 | 71 | pub const ENTER: KeyCombination = key!(enter);
|
62 |
| - pub const ALT_ENTER: KeyCombination = key!(alt - enter); |
| 72 | + pub const ALT_ENTER: KeyCombination = key!(alt-enter); |
63 | 73 |
|
64 | 74 | pub fn new(area: Area) -> Self {
|
65 | 75 | let focused_style = CompoundStyle::default();
|
@@ -272,7 +282,10 @@ impl InputField {
|
272 | 282 | /// of the input. If you want to totally handle events, you
|
273 | 283 | /// may call function like `put_char` and `del_char_left`
|
274 | 284 | /// directly.
|
275 |
| - pub fn apply_key_combination<K: Into<KeyCombination>>(&mut self, key: K) -> bool { |
| 285 | + pub fn apply_key_combination<K: Into<KeyCombination>>( |
| 286 | + &mut self, |
| 287 | + key: K, |
| 288 | + ) -> bool { |
276 | 289 | if !self.focused {
|
277 | 290 | return false;
|
278 | 291 | }
|
@@ -418,9 +431,7 @@ impl InputField {
|
418 | 431 | pub fn apply_event(&mut self, event: &Event, is_double_click: bool) -> bool {
|
419 | 432 | match event {
|
420 | 433 | Event::Mouse(mouse_event) => self.apply_mouse_event(*mouse_event, is_double_click),
|
421 |
| - Event::Key(KeyEvent { |
422 |
| - code, modifiers, .. |
423 |
| - }) if self.focused => { |
| 434 | + Event::Key(KeyEvent { code, modifiers, .. }) if self.focused => { |
424 | 435 | if modifiers.is_empty() {
|
425 | 436 | self.apply_keycode_event(*code, false)
|
426 | 437 | } else if *modifiers == KeyModifiers::SHIFT {
|
|
0 commit comments