summaryrefslogtreecommitdiff
path: root/src/term/mod.rs
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2019-02-07 00:55:18 +0000
committerGitHub <noreply@github.com>2019-02-07 00:55:18 +0000
commite561ae373393e919cf3dbbf123a98e0aad215dbc (patch)
tree3ebb6770abeb9f080ff9b6a5e11309402fdaa53c /src/term/mod.rs
parenta7a6bf53d4bbb50940559f3a411aba5c474b3409 (diff)
downloadalacritty-e561ae373393e919cf3dbbf123a98e0aad215dbc.tar.gz
alacritty-e561ae373393e919cf3dbbf123a98e0aad215dbc.zip
Fix unclickable URLs with scrolled viewport
Since scrolling the terminal moves around the underlying data structure of the terminal, the URL selection would search for the URL at the position where the click would have been without any scrolling. By adding the viewport offset to the click position, the URL clicking now searches at the correct location. This fixes https://github.com/jwilm/alacritty/issues/2076.
Diffstat (limited to 'src/term/mod.rs')
-rw-r--r--src/term/mod.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 487ba20d..c49ecbcc 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -97,10 +97,11 @@ impl Search for Term {
}
fn url_search(&self, mut point: Point<usize>) -> Option<String> {
+ // Switch first line from top to bottom
point.line = self.grid.num_lines().0 - point.line - 1;
- // Limit the starting point to the last line in the history
- point.line = min(point.line, self.grid.len() - 1);
+ // Remove viewport scroll offset
+ point.line += self.grid.display_offset();
// Create forwards and backwards iterators
let iterf = self.grid.iter_from(point);