summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/grid/tests.rs
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2019-08-01 15:37:01 +0000
committerGitHub <noreply@github.com>2019-08-01 15:37:01 +0000
commit9dddf649a15d103295f4ce97b8ae4c178c9623e0 (patch)
tree609cba8c7eecddc8a2b032e826967bcc04395592 /alacritty_terminal/src/grid/tests.rs
parentf51c7b067a05dec7863cca9b8bfaf8329b0cfdfc (diff)
downloadalacritty-9dddf649a15d103295f4ce97b8ae4c178c9623e0.tar.gz
alacritty-9dddf649a15d103295f4ce97b8ae4c178c9623e0.zip
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.
Diffstat (limited to 'alacritty_terminal/src/grid/tests.rs')
-rw-r--r--alacritty_terminal/src/grid/tests.rs15
1 files changed, 9 insertions, 6 deletions
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) });