From d9bd21d33f7f35d1362a581cefb1c897a821fcad Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Sat, 10 Mar 2018 12:14:58 +0100 Subject: Fix selection in scrollback There were a few issues with selection in scrollback that were mainly off-by-one errors. This aims at fixing these issues. This also fixes a bug that currently exists in master where the last cell is not selected when the mouse leaves the window to the right. --- src/input.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/input.rs') diff --git a/src/input.rs b/src/input.rs index 16fddc2c..7b9eda56 100644 --- a/src/input.rs +++ b/src/input.rs @@ -278,7 +278,10 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { let cell_x = (x as usize - size_info.padding_x as usize) % size_info.cell_width as usize; let half_cell_width = (size_info.cell_width / 2.0) as usize; - let cell_side = if cell_x > half_cell_width { + let cell_side = if cell_x > half_cell_width + // Edge case when mouse leaves the window + || x as f32 >= size_info.width - size_info.padding_x + { Side::Right } else { Side::Left -- cgit