move input types to their own file

This commit is contained in:
Wez Furlong committed 2018-02-10 18:41:58 -08:00
1 parent 55ae1fb76a
commit 7e7c622b79
2 files changed
+62 -58

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
use super::VisibleRowIndex;
bitflags! {
#[derive(Default)]
pub struct KeyModifiers :u8{
const CTRL = 1;
const ALT = 2;
const META = 4;
const SUPER = 8;
const SHIFT = 16;
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum KeyCode {
Char(char),
Unknown,
Control,
Alt,
Meta,
Super,
Hyper,
Shift,
Left,
Up,
Right,
Down,
PageUp,
PageDown,
Home,
End,
Insert,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum MouseButton {
Left,
Middle,
Right,
WheelUp,
WheelDown,
None,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum MouseEventKind {
Press,
Release,
Move,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct MouseEvent {
pub kind: MouseEventKind,
pub x: usize,
pub y: VisibleRowIndex,
pub button: MouseButton,
pub modifiers: KeyModifiers,
}
+3 -58
View File
@@ -26,6 +26,9 @@ use std::time::{Duration, Instant};
#[macro_use]
mod debug;
pub mod input;
pub use input::*;
pub mod selection;
use selection::{SelectionCoordinate, SelectionRange};
@@ -103,64 +106,6 @@ pub const ST: &[u8] = b"\x1b\\";
#[allow(dead_code)]
pub const DCS: &[u8] = b"\x1bP";
bitflags! {
#[derive(Default)]
pub struct KeyModifiers :u8{
const CTRL = 1;
const ALT = 2;
const META = 4;
const SUPER = 8;
const SHIFT = 16;
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum KeyCode {
Char(char),
Unknown,
Control,
Alt,
Meta,
Super,
Hyper,
Shift,
Left,
Up,
Right,
Down,
PageUp,
PageDown,
Home,
End,
Insert,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum MouseButton {
Left,
Middle,
Right,
WheelUp,
WheelDown,
None,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum MouseEventKind {
Press,
Release,
Move,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct MouseEvent {
pub kind: MouseEventKind,
pub x: usize,
pub y: VisibleRowIndex,
pub button: MouseButton,
pub modifiers: KeyModifiers,
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct CellAttributes {
attributes: u16,