summaryrefslogtreecommitdiffstats
path: root/src/event.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2018-03-13 19:00:14 +0100
committerJoe Wilm <jwilm@users.noreply.github.com>2018-03-13 16:58:15 -0700
commit6173603677c950d96c470aa609dbc07e7d4c792f (patch)
treefebd084c4ce293e7288d9704c3f1c74f1c2dadeb /src/event.rs
parentf8e36d166342d9ee4a91f8e89f55677cd0fd0644 (diff)
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 af5053f4..c079ddfb 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 last_click_timestamp: Instant,
pub click_state: ClickState,
@@ -311,13 +311,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;