Skip to content

Commit

Permalink
Breaking changes for crossterm, renaming
Browse files Browse the repository at this point in the history
Breaking change, use crossterm 0.25.0:
- Lots of new variants are added to KeyEvent, like KeyEventKind, and
  KeyEventState. This release is a breaking change. So I took this
  opportunity to upgrade lots of things in the library. The next release
  of this library will also be a breaking change (semver).
- KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES and
  PushKeyboardEnhancementFlags are added to make it possible to scan
  even more extensive key codes.
- Almost all these new changes are largely ignored. However, the
  conversion from KeyEvent to Keypress takes all of these into account.
  The biggest change is that only KeyEvents that have
  KeyEventKind::Press are even considered for conversion to Keypress
  (otherwise the `TryFrom<KeyEvent> for Keypress` fails).

Upgrade all deps:
- Run cargo upgrade to get all the latest deps, since crossterm
  introduced a breaking change anyway.

Big renaming effort:
- The naming convention that I've adopted in the codebase is when there
  is an existing symbol that collides w/ something that is already taken
  or widely used (eg: Box, or Event), then the `TW` prefix is added to
  disambiguate it as belonging to this library.
- TWBox -> FlexBox
- TWInputEvent -> InputEvent
- Add serde support to Pair, Percent, Size, etc
- Clean up and simplify all the struct names and enum and their variants
  in keypress.rs, since there have grown to be so many, adapting those
  from crossterm::event. The biggest one is probably changing
  NonMidifierKey to Key. And adding clarification to ModifierKeys and
  renaming it to ModifierKeysMask

Fix #20
  • Loading branch information
nazmulidris committed Aug 26, 2022
1 parent 35f0ca5 commit c778bac
Show file tree
Hide file tree
Showing 35 changed files with 606 additions and 362 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Expand Up @@ -39,7 +39,7 @@
"tofro",
"treememoryarena",
"tuicore",
"twinputevent",
"InputEvent",
"withmutreturns"
]
}
4 changes: 2 additions & 2 deletions Cargo.toml
Expand Up @@ -36,7 +36,7 @@ simplelog = "0.12.0"

# Time
chrono = "0.4.22"
time = "0.3.13"
time = "0.3.14"

# Misc
rand = "0.8.5"
Expand All @@ -51,7 +51,7 @@ async-trait = "0.1.57"
futures = "0.3.23"

# Crossterm & EventStream support.
crossterm = { version = "0.24.0", features = ["event-stream"] }
crossterm = { version = "0.25.0", features = ["event-stream"] }
futures-util = "0.3.23"

# Bitflags.
Expand Down

0 comments on commit c778bac

Please sign in to comment.