mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-18 13:55:23 -05:00
parent
1ca729487e
commit
104b866cb6
3 changed files with 14 additions and 8 deletions
|
@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Cursor jumping around when leaving alt screen while not in the alt screen
|
- Cursor jumping around when leaving alt screen while not in the alt screen
|
||||||
- Text lingering around when resetting while scrolled up in the history
|
- Text lingering around when resetting while scrolled up in the history
|
||||||
- Terminfo support for extended capabilities
|
- Terminfo support for extended capabilities
|
||||||
|
- Allow mouse presses and beginning of mouse selection in padding
|
||||||
|
|
||||||
## Version 0.2.9
|
## Version 0.2.9
|
||||||
|
|
||||||
|
|
|
@ -411,7 +411,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
|
||||||
} else if self.ctx.terminal().mode().intersects(motion_mode)
|
} else if self.ctx.terminal().mode().intersects(motion_mode)
|
||||||
// Only report motion when changing cells
|
// Only report motion when changing cells
|
||||||
&& (prev_line != self.ctx.mouse().line || prev_col != self.ctx.mouse().column)
|
&& (prev_line != self.ctx.mouse().line || prev_col != self.ctx.mouse().column)
|
||||||
&& size_info.contains_point(x, y)
|
&& size_info.contains_point(x, y, false)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
|
|
@ -838,12 +838,16 @@ impl SizeInfo {
|
||||||
Column(((self.width - 2. * self.padding_x) / self.cell_width) as usize)
|
Column(((self.width - 2. * self.padding_x) / self.cell_width) as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn contains_point(&self, x: usize, y:usize) -> bool {
|
pub fn contains_point(&self, x: usize, y: usize, include_padding: bool) -> bool {
|
||||||
|
if include_padding {
|
||||||
|
x < self.width as usize && y < self.height as usize
|
||||||
|
} else {
|
||||||
x < (self.width - self.padding_x) as usize
|
x < (self.width - self.padding_x) as usize
|
||||||
&& x >= self.padding_x as usize
|
&& x >= self.padding_x as usize
|
||||||
&& y < (self.height - self.padding_y) as usize
|
&& y < (self.height - self.padding_y) as usize
|
||||||
&& y >= self.padding_y as usize
|
&& y >= self.padding_y as usize
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn pixels_to_coords(&self, x: usize, y: usize) -> Point {
|
pub fn pixels_to_coords(&self, x: usize, y: usize) -> Point {
|
||||||
let col = Column(x.saturating_sub(self.padding_x as usize) / (self.cell_width as usize));
|
let col = Column(x.saturating_sub(self.padding_x as usize) / (self.cell_width as usize));
|
||||||
|
@ -1104,9 +1108,10 @@ impl Term {
|
||||||
/// The mouse coordinates are expected to be relative to the top left. The
|
/// The mouse coordinates are expected to be relative to the top left. The
|
||||||
/// line and column returned are also relative to the top left.
|
/// line and column returned are also relative to the top left.
|
||||||
///
|
///
|
||||||
/// Returns None if the coordinates are outside the screen
|
/// Returns None if the coordinates are outside the window,
|
||||||
|
/// padding pixels are considered inside the window
|
||||||
pub fn pixels_to_coords(&self, x: usize, y: usize) -> Option<Point> {
|
pub fn pixels_to_coords(&self, x: usize, y: usize) -> Option<Point> {
|
||||||
if self.size_info.contains_point(x, y) {
|
if self.size_info.contains_point(x, y, true) {
|
||||||
Some(self.size_info.pixels_to_coords(x, y))
|
Some(self.size_info.pixels_to_coords(x, y))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
Loading…
Reference in a new issue