aboutsummaryrefslogtreecommitdiff
path: root/src/event.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2018-03-13 19:00:14 +0100
committerJoe Wilm <joe@jwilm.com>2018-06-02 09:56:50 -0700
commit58c69cafad3b1dafa3631d911c6bfc21f5e5dec5 (patch)
tree73aea66e64622357685600197a9e14c30889f51d /src/event.rs
parentd9bd21d33f7f35d1362a581cefb1c897a821fcad (diff)
downloadr-alacritty-58c69cafad3b1dafa3631d911c6bfc21f5e5dec5.tar.gz
r-alacritty-58c69cafad3b1dafa3631d911c6bfc21f5e5dec5.tar.bz2
r-alacritty-58c69cafad3b1dafa3631d911c6bfc21f5e5dec5.zip
Fix multi-line selection with single cell end
When the user selected multiple lines, dragging the selection downwards, and then leaves the cursor to the left side of the first cell, the first cell was still incorrectly selected. This has been fixed. The selection also did not update if the mouse was outside of the window, now all movement events are accpeted even when the mouse is outside of the window. This allows updating the selection when the user is dragging the cursor too far. Mouse movement and click events outside of the window are not propagated, these are only used for updating the selection.
Diffstat (limited to 'src/event.rs')
-rw-r--r--src/event.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/event.rs b/src/event.rs
index 14ec0b0e..b0987d58 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -154,8 +154,8 @@ pub enum ClickState {
/// State of the mouse
pub struct Mouse {
- pub x: u32,
- pub y: u32,
+ pub x: usize,
+ pub y: usize,
pub left_button_state: ElementState,
pub middle_button_state: ElementState,
pub right_button_state: ElementState,
@@ -315,13 +315,11 @@ impl<N: Notify> Processor<N> {
processor.ctx.terminal.dirty = true;
},
CursorMoved { position: (x, y), modifiers, .. } => {
- let x = x as i32;
- let y = y as i32;
- let x = limit(x, 0, processor.ctx.size_info.width as i32);
- let y = limit(y, 0, processor.ctx.size_info.height as i32);
+ let x = limit(x as i32, 0, processor.ctx.size_info.width as i32);
+ let y = limit(y as i32, 0, processor.ctx.size_info.height as i32);
*hide_cursor = false;
- processor.mouse_moved(x as u32, y as u32, modifiers);
+ processor.mouse_moved(x as usize, y as usize, modifiers);
},
MouseWheel { delta, phase, modifiers, .. } => {
*hide_cursor = false;