diff options
author | Christian Duerr <contact@christianduerr.com> | 2019-08-26 18:09:20 +0200 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2019-08-26 18:11:36 +0200 |
commit | 5f7fb4c3e27fc352f161a152fdcf2805cdbf2158 (patch) | |
tree | 7683cf0c489b8a106a0e7c3b63c0a3a9b7befb73 /alacritty_terminal | |
parent | 06e52a62660a0604498d8c11bdc621ac9c218606 (diff) | |
download | alacritty-5f7fb4c3e27fc352f161a152fdcf2805cdbf2158.tar.gz alacritty-5f7fb4c3e27fc352f161a152fdcf2805cdbf2158.zip |
Fix url highlight not showing with required modifiers
Diffstat (limited to 'alacritty_terminal')
-rw-r--r-- | alacritty_terminal/src/grid/mod.rs | 2 | ||||
-rw-r--r-- | alacritty_terminal/src/input.rs | 28 |
2 files changed, 18 insertions, 12 deletions
diff --git a/alacritty_terminal/src/grid/mod.rs b/alacritty_terminal/src/grid/mod.rs index 2d191d20..01c17152 100644 --- a/alacritty_terminal/src/grid/mod.rs +++ b/alacritty_terminal/src/grid/mod.rs @@ -280,7 +280,7 @@ impl<T: GridCell + Copy + Clone> Grid<T> { last_row.append(&mut cells); if row.is_empty() { - let raw_len = i + 1 + new_raw.len();; + let raw_len = i + 1 + new_raw.len(); if raw_len < self.lines.0 || self.scroll_limit == 0 { // Add new line and move lines up if we can't pull from history cursor_pos.line = Line(cursor_pos.line.saturating_sub(1)); diff --git a/alacritty_terminal/src/input.rs b/alacritty_terminal/src/input.rs index 3144e23f..b7d1ba05 100644 --- a/alacritty_terminal/src/input.rs +++ b/alacritty_terminal/src/input.rs @@ -119,8 +119,8 @@ impl Modifiers { } } -impl From<Modifiers> for ModifiersState { - fn from(mods: Modifiers) -> ModifiersState { +impl From<&mut Modifiers> for ModifiersState { + fn from(mods: &mut Modifiers) -> ModifiersState { ModifiersState { shift: mods.shift(), ..mods.mods } } } @@ -432,7 +432,7 @@ pub enum MouseState { } impl<'a, A: ActionContext + 'a> Processor<'a, A> { - fn mouse_state(&mut self, point: Point) -> MouseState { + fn mouse_state(&mut self, point: Point, mods: ModifiersState) -> MouseState { let mouse_mode = TermMode::MOUSE_MOTION | TermMode::MOUSE_DRAG | TermMode::MOUSE_REPORT_CLICK; @@ -446,9 +446,8 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { } // Check for URL at point with required modifiers held - let mods = *self.ctx.modifiers(); - if self.mouse_config.url.mods().relaxed_eq(mods.into()) - && (!self.ctx.terminal().mode().intersects(mouse_mode) || mods.shift()) + if self.mouse_config.url.mods().relaxed_eq(mods) + && (!self.ctx.terminal().mode().intersects(mouse_mode) || mods.shift) && self.mouse_config.url.launcher.is_some() { let buffer_point = self.ctx.terminal().visible_to_buffer(point); @@ -493,7 +492,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { // Don't launch URLs if mouse has moved self.ctx.mouse_mut().block_url_launcher = true; - let mouse_state = self.mouse_state(point); + let mouse_state = self.mouse_state(point, modifiers); self.update_mouse_cursor(mouse_state); match mouse_state { MouseState::Url(url) => { @@ -821,7 +820,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { if let Some(message) = self.message_at_point(point) { // Message should never be `Some` if point is `None` debug_assert!(point.is_some()); - self.on_message_bar_click(state, point.unwrap(), message); + self.on_message_bar_click(state, point.unwrap(), message, modifiers); } else { match state { ElementState::Pressed => { @@ -844,7 +843,8 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { || input.virtual_keycode == Some(VirtualKeyCode::RShift) { if let Some(point) = self.ctx.mouse_coords() { - let mouse_state = self.mouse_state(point); + let mods = self.ctx.modifiers().into(); + let mouse_state = self.mouse_state(point, mods); self.update_mouse_cursor(mouse_state); } } @@ -979,12 +979,18 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { } /// Handle clicks on the message bar. - fn on_message_bar_click(&mut self, button_state: ElementState, point: Point, message: Message) { + fn on_message_bar_click( + &mut self, + button_state: ElementState, + point: Point, + message: Message, + mods: ModifiersState, + ) { match button_state { ElementState::Released => self.copy_selection(), ElementState::Pressed => { if self.message_close_at_point(point, message) { - let mouse_state = self.mouse_state(point); + let mouse_state = self.mouse_state(point, mods); self.update_mouse_cursor(mouse_state); self.ctx.terminal_mut().message_buffer_mut().pop(); } |