Fix mouse mode generate events without cell change
This commit is contained in:
parent
2c462c7d03
commit
21a97c1ef2
|
@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- PTY size not getting updated when message bar is shown
|
- PTY size not getting updated when message bar is shown
|
||||||
- Text Cursor disappearing
|
- Text Cursor disappearing
|
||||||
- Incorrect positioning of zero-width characters over double-width characters
|
- Incorrect positioning of zero-width characters over double-width characters
|
||||||
|
- Mouse mode generating events when the cell has not changed
|
||||||
|
|
||||||
## Version 0.3.2
|
## Version 0.3.2
|
||||||
|
|
||||||
|
|
|
@ -422,22 +422,22 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
|
||||||
let motion_mode = TermMode::MOUSE_MOTION | TermMode::MOUSE_DRAG;
|
let motion_mode = TermMode::MOUSE_MOTION | TermMode::MOUSE_DRAG;
|
||||||
let report_mode = TermMode::MOUSE_REPORT_CLICK | motion_mode;
|
let report_mode = TermMode::MOUSE_REPORT_CLICK | motion_mode;
|
||||||
|
|
||||||
let mouse_moved = prev_line != self.ctx.mouse().line
|
let cell_changed =
|
||||||
|| prev_col != self.ctx.mouse().column
|
prev_line != self.ctx.mouse().line || prev_col != self.ctx.mouse().column;
|
||||||
|| prev_side != cell_side;
|
let mouse_moved = cell_changed || prev_side != cell_side;
|
||||||
|
|
||||||
// Don't launch URLs if mouse has moved
|
|
||||||
if mouse_moved {
|
|
||||||
self.ctx.mouse_mut().block_url_launcher = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only report motions when cell changed and mouse is not over the message bar
|
// Only report motions when cell changed and mouse is not over the message bar
|
||||||
if self.message_at_point(Some(point)).is_some() || !mouse_moved {
|
if self.message_at_point(Some(point)).is_some() || !mouse_moved {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't launch URLs if mouse has moved
|
||||||
|
self.ctx.mouse_mut().block_url_launcher = true;
|
||||||
|
|
||||||
// Underline URLs and change cursor on hover
|
// Underline URLs and change cursor on hover
|
||||||
self.update_url_highlight(point, modifiers);
|
if cell_changed {
|
||||||
|
self.update_url_highlight(point, modifiers);
|
||||||
|
}
|
||||||
|
|
||||||
if self.ctx.mouse().left_button_state == ElementState::Pressed
|
if self.ctx.mouse().left_button_state == ElementState::Pressed
|
||||||
&& (modifiers.shift || !self.ctx.terminal().mode().intersects(report_mode))
|
&& (modifiers.shift || !self.ctx.terminal().mode().intersects(report_mode))
|
||||||
|
@ -445,6 +445,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
|
||||||
self.ctx.update_selection(Point { line: point.line, col: point.col }, cell_side);
|
self.ctx.update_selection(Point { line: point.line, col: point.col }, cell_side);
|
||||||
} else if self.ctx.terminal().mode().intersects(motion_mode)
|
} else if self.ctx.terminal().mode().intersects(motion_mode)
|
||||||
&& size_info.contains_point(x, y, false)
|
&& size_info.contains_point(x, y, false)
|
||||||
|
&& cell_changed
|
||||||
{
|
{
|
||||||
if self.ctx.mouse().left_button_state == ElementState::Pressed {
|
if self.ctx.mouse().left_button_state == ElementState::Pressed {
|
||||||
self.mouse_report(32, ElementState::Pressed, modifiers);
|
self.mouse_report(32, ElementState::Pressed, modifiers);
|
||||||
|
|
Loading…
Reference in New Issue