refactor(core): Use the new `keymaps` crate

This commit is contained in:
Benedikt Peetz 2023-11-07 20:27:06 +01:00
parent 5f69311dfa
commit 2eb6b12bd7
Signed by: bpeetz
GPG Key ID: A5E94010C3A642AD
5 changed files with 11 additions and 13 deletions

View File

@ -19,6 +19,7 @@ tokio = { version = "1.33", features = ["macros", "rt-multi-thread"] }
# lua stuff # lua stuff
language_macros = { path = "./language_macros" } language_macros = { path = "./language_macros" }
keymaps = { path = "./keymaps", features = ["crossterm"] }
mlua = { version = "0.9.1", features = ["lua54", "async", "send", "serialize"] } mlua = { version = "0.9.1", features = ["lua54", "async", "send", "serialize"] }
once_cell = "1.18.0" once_cell = "1.18.0"

View File

@ -3,6 +3,10 @@ use std::{collections::HashMap, str::FromStr};
use anyhow::{Error, Result}; use anyhow::{Error, Result};
use cli_log::{info, trace, warn}; use cli_log::{info, trace, warn};
use crossterm::event::Event; use crossterm::event::Event;
use keymaps::{
key_repr::{Key, Keys},
trie::Node,
};
use tokio::sync::oneshot; use tokio::sync::oneshot;
use crate::{ use crate::{
@ -12,10 +16,6 @@ use crate::{
Api, Command, Debug, Keymaps, Raw, Trinitrix, Ui, Api, Command, Debug, Keymaps, Raw, Trinitrix, Ui,
}, },
events::EventStatus, events::EventStatus,
keymappings::{
key::{Key, Keys},
trie::Node,
},
status::State, status::State,
App, App,
}, },

View File

@ -1,11 +1,11 @@
use anyhow::Result; use anyhow::Result;
use cli_log::info; use cli_log::info;
use crossterm::event::Event as CrosstermEvent; use crossterm::event::Event as CrosstermEvent;
use keymaps::key_repr::{Key, Keys};
use crate::app::{ use crate::app::{
command_interface::{Api::Raw, Command, Raw::SendInputUnprocessed, Trinitrix::Api}, command_interface::{Api::Raw, Command, Raw::SendInputUnprocessed, Trinitrix::Api},
events::{Event, EventStatus}, events::{Event, EventStatus},
keymappings::key::{Key, Keys},
status::State, status::State,
App, App,
}; };

View File

@ -1,7 +1,6 @@
pub mod command_interface; pub mod command_interface;
pub mod config; pub mod config;
pub mod events; pub mod events;
pub mod keymappings;
pub mod status; pub mod status;
use std::{ use std::{
@ -12,16 +11,15 @@ use std::{
use anyhow::{Context, Error, Result}; use anyhow::{Context, Error, Result};
use cli_log::{info, warn}; use cli_log::{info, warn};
use directories::ProjectDirs; use directories::ProjectDirs;
use keymaps::trie::Node;
use matrix_sdk::Client; use matrix_sdk::Client;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tokio_util::sync::CancellationToken; use tokio_util::sync::CancellationToken;
use self::{ use self::command_interface::{
command_interface::{
command_transfer_value::support_types::Function, lua_command_manager::LuaCommandManager, command_transfer_value::support_types::Function, lua_command_manager::LuaCommandManager,
},
keymappings::trie::Node,
}; };
use crate::{ use crate::{
accounts::{Account, AccountsManager}, accounts::{Account, AccountsManager},
app::{ app::{

View File

@ -3,6 +3,7 @@ use core::fmt;
use anyhow::{bail, Error, Result}; use anyhow::{bail, Error, Result};
use cli_log::warn; use cli_log::warn;
use indexmap::IndexMap; use indexmap::IndexMap;
use keymaps::key_repr::Keys;
use matrix_sdk::{ use matrix_sdk::{
room::MessagesOptions, room::MessagesOptions,
ruma::{ ruma::{
@ -12,8 +13,6 @@ use matrix_sdk::{
Client, Client,
}; };
use super::keymappings::key::Keys;
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Debug)] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Debug)]
pub enum State { pub enum State {
Normal, Normal,