@@ -31,6 +31,7 @@ use zellij_utils::{consts::VERSION, shared::version_number};
31
31
32
32
use crate :: output:: { CharacterChunk , OutputBuffer , SixelImageChunk } ;
33
33
use crate :: panes:: alacritty_functions:: { parse_number, xparse_color} ;
34
+ use crate :: panes:: hyperlink_tracker:: HyperlinkTracker ;
34
35
use crate :: panes:: link_handler:: LinkHandler ;
35
36
use crate :: panes:: search:: SearchResult ;
36
37
use crate :: panes:: selection:: Selection ;
@@ -363,6 +364,7 @@ pub struct Grid {
363
364
explicitly_disable_kitty_keyboard_protocol : bool , // has kitty keyboard support been explicitly
364
365
// disabled by user config?
365
366
click : Click ,
367
+ hyperlink_tracker : HyperlinkTracker ,
366
368
}
367
369
368
370
const CLICK_TIME_THRESHOLD : u128 = 400 ; // Doherty Threshold
@@ -550,6 +552,7 @@ impl Grid {
550
552
supports_kitty_keyboard_protocol : false ,
551
553
explicitly_disable_kitty_keyboard_protocol,
552
554
click : Click :: default ( ) ,
555
+ hyperlink_tracker : HyperlinkTracker :: new ( ) ,
553
556
}
554
557
}
555
558
pub fn render_full_viewport ( & mut self ) {
@@ -1294,6 +1297,13 @@ impl Grid {
1294
1297
}
1295
1298
pub fn add_canonical_line ( & mut self ) {
1296
1299
let ( scroll_region_top, scroll_region_bottom) = self . scroll_region ;
1300
+ self . hyperlink_tracker . update (
1301
+ '\n' ,
1302
+ & self . cursor ,
1303
+ & mut self . viewport ,
1304
+ & mut self . lines_above ,
1305
+ & mut self . link_handler . borrow_mut ( ) ,
1306
+ ) ;
1297
1307
if self . cursor . y == scroll_region_bottom {
1298
1308
// end of scroll region
1299
1309
// when we have a scroll region set and we're at its bottom
@@ -1348,6 +1358,13 @@ impl Grid {
1348
1358
terminal_character : TerminalCharacter ,
1349
1359
should_insert_character : bool ,
1350
1360
) {
1361
+ self . hyperlink_tracker . update (
1362
+ terminal_character. character ,
1363
+ & self . cursor ,
1364
+ & mut self . viewport ,
1365
+ & mut self . lines_above ,
1366
+ & mut self . link_handler . borrow_mut ( ) ,
1367
+ ) ;
1351
1368
// this function assumes the current line has enough room for terminal_character (that its
1352
1369
// width has been checked beforehand)
1353
1370
match self . viewport . get_mut ( self . cursor . y ) {
@@ -1477,6 +1494,7 @@ impl Grid {
1477
1494
if self . cursor . y == self . height . saturating_sub ( 1 ) {
1478
1495
if self . alternate_screen_state . is_none ( ) {
1479
1496
self . transfer_rows_to_lines_above ( 1 ) ;
1497
+ self . hyperlink_tracker . offset_cursor_lines ( 1 ) ;
1480
1498
} else {
1481
1499
self . viewport . remove ( 0 ) ;
1482
1500
}
0 commit comments