diff options
author | Joe Wilm <joe@jwilm.com> | 2016-12-29 20:39:30 -0500 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-12-29 20:53:41 -0500 |
commit | b704dafb2420df6f7fca64980a2f52c1a00bcef5 (patch) | |
tree | f4659fa9ba38a8626d478e23d97b331c6dd5f8dc /src/event.rs | |
parent | f1336ee1c74c8e3d324ff7b32b562a64046df5ce (diff) | |
download | alacritty-b704dafb2420df6f7fca64980a2f52c1a00bcef5.tar.gz alacritty-b704dafb2420df6f7fca64980a2f52c1a00bcef5.zip |
Fix some bugs with selections
Moving the window on macOS would cause a panic in certain circumstances.
Diffstat (limited to 'src/event.rs')
-rw-r--r-- | src/event.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/event.rs b/src/event.rs index 47621af3..c516f151 100644 --- a/src/event.rs +++ b/src/event.rs @@ -15,6 +15,7 @@ use input::{self, ActionContext, MouseBinding, KeyBinding}; use selection::Selection; use sync::FairMutex; use term::{Term, SizeInfo}; +use util::limit; use window::Window; /// Byte sequences are sent to a `Notify` in response to some events @@ -148,12 +149,13 @@ impl<N: Notify> Processor<N> { *wakeup_request = true; }, glutin::Event::MouseMoved(x, y) => { - if x > 0 && y > 0 { - processor.mouse_moved(x as u32, y as u32); + let x = limit(x, 0, processor.ctx.size_info.width as i32); + let y = limit(y, 0, processor.ctx.size_info.height as i32); - if !processor.ctx.selection.is_empty() { - *wakeup_request = true; - } + processor.mouse_moved(x as u32, y as u32); + + if !processor.ctx.selection.is_empty() { + *wakeup_request = true; } }, glutin::Event::Focused(true) => { |