diff options
author | Blaž Hrastnik | 2020-09-21 09:24:16 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-09-21 09:24:16 +0000 |
commit | 935cfeae576f734e6cbd455bfa39df014700ae86 (patch) | |
tree | a4abe959b718f265ade4a66a844bfefadc546f90 /helix-core | |
parent | 48330ddb5f36a1c5f44a636525089a019ce4439d (diff) |
Split parts of helix-term into helix-view.
It still largely depends on term for some types but I plan to change
that later.
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/src/lib.rs | 2 | ||||
-rw-r--r-- | helix-core/src/macros.rs | 17 | ||||
-rw-r--r-- | helix-core/src/state.rs | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index c617fdbf..e443168e 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -1,5 +1,7 @@ #![allow(unused)] +pub mod config; pub mod graphemes; +pub mod macros; mod position; mod selection; pub mod state; diff --git a/helix-core/src/macros.rs b/helix-core/src/macros.rs new file mode 100644 index 00000000..1321ea5f --- /dev/null +++ b/helix-core/src/macros.rs @@ -0,0 +1,17 @@ +#[macro_export] +macro_rules! hashmap { + (@single $($x:tt)*) => (()); + (@count $($rest:expr),*) => (<[()]>::len(&[$(hashmap!(@single $rest)),*])); + + ($($key:expr => $value:expr,)+) => { hashmap!($($key => $value),+) }; + ($($key:expr => $value:expr),*) => { + { + let _cap = hashmap!(@count $($key),*); + let mut _map = ::std::collections::HashMap::with_capacity(_cap); + $( + let _ = _map.insert($key, $value); + )* + _map + } + }; +} diff --git a/helix-core/src/state.rs b/helix-core/src/state.rs index 5b5f06c0..79e15eff 100644 --- a/helix-core/src/state.rs +++ b/helix-core/src/state.rs @@ -4,7 +4,7 @@ use anyhow::Error; use std::path::PathBuf; -#[derive(Copy, Clone)] +#[derive(Copy, Clone, PartialEq, Eq, Hash)] pub enum Mode { Normal, Insert, |