aboutsummaryrefslogtreecommitdiff
path: root/src/input.rs
diff options
context:
space:
mode:
authorCarlos Tuñón <camotubi@gmail.com>2019-01-05 15:47:12 -0500
committerChristian Duerr <chrisduerr@users.noreply.github.com>2019-01-05 20:47:12 +0000
commite4dc43e87c5330c1f22dc2e7570d7e66881ef647 (patch)
treeb8bfa95519ac71845d5ed2bc873cfdd57dc27993 /src/input.rs
parentf4fc9eb35a02426dac33a19e2cb9ff182d745316 (diff)
downloadalacritty-e4dc43e87c5330c1f22dc2e7570d7e66881ef647.tar.gz
alacritty-e4dc43e87c5330c1f22dc2e7570d7e66881ef647.zip
Add key/mouse action for spawning new Alacritty instances
Diffstat (limited to 'src/input.rs')
-rw-r--r--src/input.rs42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/input.rs b/src/input.rs
index be5dc264..2e949d64 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -75,6 +75,7 @@ pub trait ActionContext {
fn hide_window(&mut self);
fn url(&self, _: Point<usize>) -> Option<String>;
fn clear_log(&mut self);
+ fn spawn_new_instance(&mut self);
}
/// Describes a state and action to take in that state
@@ -202,6 +203,9 @@ pub enum Action {
/// Clears warning and error notices.
ClearLogNotice,
+
+ /// Spawn a new instance of Alacritty.
+ SpawnNewInstance,
}
impl Action {
@@ -279,7 +283,10 @@ impl Action {
},
Action::ClearLogNotice => {
ctx.clear_log();
- }
+ },
+ Action::SpawnNewInstance => {
+ ctx.spawn_new_instance();
+ },
}
}
@@ -793,9 +800,17 @@ mod tests {
}
impl <'a>super::ActionContext for ActionContext<'a> {
- fn write_to_pty<B: Into<Cow<'static, [u8]>>>(&mut self, _val: B) {
- // STUBBED
- }
+ fn write_to_pty<B: Into<Cow<'static, [u8]>>>(&mut self, _val: B) {}
+ fn update_selection(&mut self, _point: Point, _side: Side) {}
+ fn simple_selection(&mut self, _point: Point, _side: Side) {}
+ fn copy_selection(&self, _buffer: ClipboardBuffer) {}
+ fn clear_selection(&mut self) {}
+ fn change_font_size(&mut self, _delta: f32) {}
+ fn reset_font_size(&mut self) {}
+ fn clear_history(&mut self) {}
+ fn clear_log(&mut self) {}
+ fn hide_window(&mut self) {}
+ fn spawn_new_instance(&mut self) {}
fn terminal_mode(&self) -> TermMode {
*self.terminal.mode()
@@ -805,14 +820,6 @@ mod tests {
*self.size_info
}
- fn copy_selection(&self, _buffer: ClipboardBuffer) {
- // STUBBED
- }
-
- fn clear_selection(&mut self) {}
- fn update_selection(&mut self, _point: Point, _side: Side) {}
- fn simple_selection(&mut self, _point: Point, _side: Side) {}
-
fn semantic_selection(&mut self, _point: Point) {
// set something that we can check for here
self.last_action = MultiClick::DoubleClick;
@@ -851,21 +858,14 @@ mod tests {
fn received_count(&mut self) -> &mut usize {
&mut self.received_count
}
+
fn suppress_chars(&mut self) -> &mut bool {
&mut self.suppress_chars
}
+
fn last_modifiers(&mut self) -> &mut ModifiersState {
&mut self.last_modifiers
}
- fn change_font_size(&mut self, _delta: f32) {
- }
- fn reset_font_size(&mut self) {
- }
- fn clear_history(&mut self) {
- }
- fn hide_window(&mut self) {
- }
- fn clear_log(&mut self) {}
}
macro_rules! test_clickstate {