tui-realm 0.6.0
0.6.0
Released on 03/08/2021
Yet another update...
- ❗ Compatibility with tui
0.16
and crossterm0.20
❗-
You can now set the block title alignment
- Added
title
toProps
BlockTitle
type inProps
, which is made up oftext
andalignment
. Use this instead of setting title inown
map
- Added
-
🔴 A really bad new in
Msg
matching 😭in crossterm
0.20
to solve an issue they removed the#[derive(Eq, PartialEq)]
fromKeyEvent
.
This has now caused an issue when matching againstOnKey
events:error: to use a constant of type `KeyEvent` in a pattern, `KeyEvent` must be annotated with `#[derive(PartialEq, Eq)]`
To solve this issue you must from now on use a guard match to match keys:
fn update(model: &mut Model, view: &mut View, msg: Option<(String, Msg)>) -> Option<(String, Msg)> { let ref_msg: Option<(&str, &Msg)> = msg.as_ref().map(|(s, msg)| (s.as_str(), msg)); match ref_msg { None => None, // Exit after None Some(msg) => match msg { (COMPONENT_COUNTER1, key) if key == &MSG_KEY_TAB => { view.active(COMPONENT_COUNTER2); None } (COMPONENT_COUNTER2, key) if key == &MSG_KEY_TAB => { view.active(COMPONENT_COUNTER1); None } (_, key) if key == &MSG_KEY_ESC => { // Quit on esc model.quit(); None } _ => None, }, } }
-