about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/types/command.rs5
-rw-r--r--src/types/direction.rs4
-rw-r--r--src/types/entity_map.rs5
-rw-r--r--src/types/mod.rs6
4 files changed, 16 insertions, 4 deletions
diff --git a/src/types/command.rs b/src/types/command.rs
index 2a51531c0a8a..15017cde9904 100644
--- a/src/types/command.rs
+++ b/src/types/command.rs
@@ -23,6 +23,11 @@ impl Command {
             Char('k') | Char('w') | Key::Up => Some(Move(Up)),
             Char('j') | Char('s') | Key::Down => Some(Move(Down)),
             Char('l') | Char('d') | Key::Right => Some(Move(Right)),
+            Char('y') => Some(Move(UpLeft)),
+            Char('u') => Some(Move(UpRight)),
+            Char('b') => Some(Move(DownLeft)),
+            Char('n') => Some(Move(DownRight)),
+
             Ctrl('p') => Some(PreviousMessage),
             _ => None,
         }
diff --git a/src/types/direction.rs b/src/types/direction.rs
index 5ab660f19317..9b5c0991da8d 100644
--- a/src/types/direction.rs
+++ b/src/types/direction.rs
@@ -6,4 +6,8 @@ pub enum Direction {
     Up,
     Down,
     Right,
+    UpLeft,
+    UpRight,
+    DownRight,
+    DownLeft,
 }
diff --git a/src/types/entity_map.rs b/src/types/entity_map.rs
index 1846686d1164..1d58873bb0ac 100644
--- a/src/types/entity_map.rs
+++ b/src/types/entity_map.rs
@@ -234,10 +234,9 @@ mod tests {
                 em.get(entity_id).map(|e| e.position()),
                 Some(new_position)
             );
-            assert_eq!(
+            assert!(
                 em.at(new_position).iter().map(
-                    |e| e.name.clone()).collect::<Vec<_>>(),
-                vec![ent.name]
+                    |e| e.name.clone()).any(|en| en == ent.name),
             )
         }
 
diff --git a/src/types/mod.rs b/src/types/mod.rs
index 67c773fdb107..ac44bcc9c89e 100644
--- a/src/types/mod.rs
+++ b/src/types/mod.rs
@@ -8,7 +8,7 @@ pub mod direction;
 pub mod entity_map;
 pub use collision::Collision;
 pub use direction::Direction;
-pub use direction::Direction::{Down, Left, Right, Up};
+pub use direction::Direction::*;
 use proptest_derive::Arbitrary;
 use termion::cursor;
 
@@ -217,6 +217,10 @@ impl ops::Add<Direction> for Position {
                     self
                 }
             }
+            UpLeft => self + Up + Left,
+            UpRight => self + Up + Right,
+            DownLeft => self + Down + Left,
+            DownRight => self + Down + Right,
         }
     }
 }