From 9dddf649a15d103295f4ce97b8ae4c178c9623e0 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Thu, 1 Aug 2019 15:37:01 +0000 Subject: Switch to rfind_url for URL detection This switches to rfind_url for detecting URLs inside the grid. Instead of expanding at the cursor position, the complete terminal is searched from the bottom until the visible region is left with no active URL. Instead of having the field `cur` publicly accessibly on the `DisplayIterator`, there are the two methods `DisplayIterator::point` and `DisplayIterator::cell` for accessing the current element of the iterator now. This allows accessing the current element right after creating the iterator. Fixes #2629. Fixes #2627. --- alacritty_terminal/src/grid/tests.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'alacritty_terminal/src/grid/tests.rs') diff --git a/alacritty_terminal/src/grid/tests.rs b/alacritty_terminal/src/grid/tests.rs index a352e747..d28e7833 100644 --- a/alacritty_terminal/src/grid/tests.rs +++ b/alacritty_terminal/src/grid/tests.rs @@ -109,8 +109,8 @@ fn test_iter() { assert_eq!(None, iter.prev()); assert_eq!(Some(&1), iter.next()); - assert_eq!(Column(1), iter.cur.col); - assert_eq!(4, iter.cur.line); + assert_eq!(Column(1), iter.point().col); + assert_eq!(4, iter.point().line); assert_eq!(Some(&2), iter.next()); assert_eq!(Some(&3), iter.next()); @@ -118,12 +118,15 @@ fn test_iter() { // test linewrapping assert_eq!(Some(&5), iter.next()); - assert_eq!(Column(0), iter.cur.col); - assert_eq!(3, iter.cur.line); + assert_eq!(Column(0), iter.point().col); + assert_eq!(3, iter.point().line); assert_eq!(Some(&4), iter.prev()); - assert_eq!(Column(4), iter.cur.col); - assert_eq!(4, iter.cur.line); + assert_eq!(Column(4), iter.point().col); + assert_eq!(4, iter.point().line); + + // Make sure iter.cell() returns the current iterator position + assert_eq!(&4, iter.cell()); // test that iter ends at end of grid let mut final_iter = grid.iter_from(Point { line: 0, col: Column(4) }); -- cgit