diff options
author | Christian Duerr <contact@christianduerr.com> | 2019-11-03 21:59:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-03 21:59:28 +0100 |
commit | b47a88b142a8987f1d0d48db8c0db1e5f3048a76 (patch) | |
tree | 0863fb40b8e081ccc40f1437e74c49a68f4e6c59 /alacritty/src/event.rs | |
parent | fa6ceacfa4158c568c55dff85621788ff1df4099 (diff) | |
download | r-alacritty-b47a88b142a8987f1d0d48db8c0db1e5f3048a76.tar.gz r-alacritty-b47a88b142a8987f1d0d48db8c0db1e5f3048a76.tar.bz2 r-alacritty-b47a88b142a8987f1d0d48db8c0db1e5f3048a76.zip |
Fix URL highlighting
Fixes #2898.
Fixes #2479.
Diffstat (limited to 'alacritty/src/event.rs')
-rw-r--r-- | alacritty/src/event.rs | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 75e06f30..5a486206 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -146,7 +146,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon let x = self.mouse.x as usize; let y = self.mouse.y as usize; - if self.size_info.contains_point(x, y, true) { + if self.size_info.contains_point(x, y) { Some(self.size_info.pixels_to_coords(x, y)) } else { None @@ -273,6 +273,7 @@ pub struct Mouse { pub lines_scrolled: f32, pub block_url_launcher: bool, pub last_button: MouseButton, + pub inside_grid: bool, } impl Default for Mouse { @@ -292,6 +293,7 @@ impl Default for Mouse { lines_scrolled: 0.0, block_url_launcher: false, last_button: MouseButton::Other(0), + inside_grid: false, } } } @@ -396,7 +398,11 @@ impl<N: Notify> Processor<N> { font_size: &mut self.font_size, config: &mut self.config, }; - let mut processor = input::Processor::new(context); + let mut processor = input::Processor::new( + context, + &self.display.urls, + &self.display.highlighted_url, + ); for event in event_queue.drain(..) { Processor::handle_event(event, &mut processor); @@ -441,7 +447,13 @@ impl<N: Notify> Processor<N> { } // Redraw screen - self.display.draw(terminal, &self.message_buffer, &self.config); + self.display.draw( + terminal, + &self.message_buffer, + &self.config, + &self.mouse, + self.modifiers.into(), + ); } }); @@ -572,9 +584,15 @@ impl<N: Notify> Processor<N> { processor.ctx.size_info.dpr = dpr; }, RedrawRequested => processor.ctx.terminal.dirty = true, + CursorLeft { .. } => { + processor.ctx.mouse.inside_grid = false; + + if processor.highlighted_url.is_some() { + processor.ctx.terminal.dirty = true; + } + }, TouchpadPressure { .. } | CursorEntered { .. } - | CursorLeft { .. } | AxisMotion { .. } | HoveredFileCancelled | Destroyed @@ -603,7 +621,6 @@ impl<N: Notify> Processor<N> { match event { TouchpadPressure { .. } | CursorEntered { .. } - | CursorLeft { .. } | AxisMotion { .. } | HoveredFileCancelled | Destroyed |