1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00

Avoid text cursor location for hyperlink preview

Fixes #6325.
This commit is contained in:
Kirill Chibisov 2022-09-14 05:33:15 +03:00 committed by GitHub
parent f2e74d9947
commit bf3e882293
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1026,7 +1026,8 @@ impl Display {
// Draw hyperlink uri preview.
if has_highlighted_hint {
self.draw_hyperlink_preview(config, vi_cursor_point, display_offset);
let cursor_point = vi_cursor_point.or(Some(cursor_point));
self.draw_hyperlink_preview(config, cursor_point, display_offset);
}
// Frame event should be requested before swaping buffers, since it requires surface
@ -1234,7 +1235,7 @@ impl Display {
fn draw_hyperlink_preview(
&mut self,
config: &UiConfig,
vi_cursor_point: Option<Point>,
cursor_point: Option<Point>,
display_offset: usize,
) {
let num_cols = self.size_info.columns();
@ -1260,7 +1261,7 @@ impl Display {
// Prefer to show preview even when it'll likely obscure the highlighted hint, when
// there's no place left for it.
protected_lines.push(self.hint_mouse_point.map(|point| point.line));
protected_lines.push(vi_cursor_point.map(|point| point.line));
protected_lines.push(cursor_point.map(|point| point.line));
}
// Find the line in viewport we can draw preview on without obscuring protected lines.