Skip to content

Upgrade from 0.13 to 0.14

Timon edited this page Nov 16, 2019 · 19 revisions

Table of Contents

Feature Flags

  • Removed cursor, style, terminal and screen feature flags
    • All the functionality is included by default and there's no way how to disable it.
  • Removed input feature flag
  • New feature flag event
    • Enables event module and allows you to handle events like key input, mouse input, and terminal resize.
  • New feature flag async-event
    • Auto enables event feature and provides EventStream (futures::Stream) on top of the event module that can be used for asynchronous event reading.

Motivation

  • The previous features flags were getting unmanageable
  • Death code is getting compiled away anyways
  • Other modules than the event module, is not depending on lots of external code, that is why we chose to keep the event flag and remove the other ones.
  • Crossterm has shrunk a few thousand lines of code since the feature flags were introduced.
  • Easier development on our side.

Why did we keep event (old input flag) and introduced async-event

  • The event module brings some additional dependencies like bitflags, parking_lot and mio, and the most used module. That is styling.
  • The async-event feature is introduced because not everyone wants to use async stuff and it also brings in the futures crate dependency.

Modules

Module input

The whole input module was removed. To be more precise, replaced with the brand new event module with lot's of new features.

Module event

New Features

  • Terminal Resize Events
  • Advanced Modifier (ALT, SHIFT, CTRL) support, for both key and mouse buttons.
  • Less resource-consuming event handling on windows (WaitForMultipleObjects) and UNIX (MIO). No more spinning loop and threading work.
  • Async environment support.
  • Simplistic API poll(Duration) and read.

TODO

  • Change of Event enums to Structs
  • Support for modifiers, bitwise, bitflag
  • Supported for more events
  • Rename of certain events
  • poll/read api
  • Async Support
  • links to places for help, examples, discord.