keymaps 1.2.0

A rust crate which provides a standardized encoding for key codes
Documentation
// keymaps - A rust crate which provides a standardized encoding for key codes
//
// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
//
// This file is part of the keymaps crate.
//
// You should have received a copy of the License along with this program.
// If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>.

use crossterm::event::{Event, KeyCode, KeyEvent, KeyEventKind, KeyEventState, KeyModifiers};

use crate::key_repr::Key;

#[test]
fn test_crossterm_roundtrip() {
    let crossterm_event = Event::Key(KeyEvent {
        code: KeyCode::Up,
        modifiers: KeyModifiers::all(),
        kind: KeyEventKind::Press,
        state: KeyEventState::all(),
    });

    let keymap_code: Key = (&crossterm_event).try_into().unwrap();

    assert_eq!(keymap_code.to_string(), "<ACMS-<UP>>".to_owned());

    // FIXME(@bpeetz): This currently does not work. <2025-01-31>
    // let crossterm: Event = keymap_code.into();
    // assert_eq!(crossterm, crossterm_event);
}