■ ■ ■ ■ ■ ■ ■
alacritty_terminal/src/term/search.rs
skipped 204 lines 205 205 let mut state = dfa.start_state(); 206 206 let mut last_wrapped = false; 207 207 let mut regex_match = None; 208 + let mut done = false; 208 209 209 210 let mut cell = iter.cell(); 210 211 self.skip_fullwidth(&mut iter, &mut cell, direction); skipped 28 lines 239 240 } 240 241 241 242 // Stop once we've reached the target point. 242 - if point == end { 243 + if point == end | | done { 243 244 break; 244 245 } 245 246 skipped 8 lines 254 255 iter.cell() 255 256 }, 256 257 }; 258 + 259 + // Check for completion before potentially skipping over fullwidth characters. 260 + done = iter.point() == end; 261 + 257 262 self.skip_fullwidth(&mut iter, &mut cell, direction); 263 + 258 264 let wrapped = cell.flags.contains(Flags::WRAPLINE); 259 265 c = cell.c; 260 266 skipped 437 lines 698 704 let start = Point::new(Line(0), Column(1)); 699 705 let end = Point::new(Line(0), Column(0)); 700 706 assert_eq!(term.regex_search_left(&dfas, start, end), Some(end..=start)); 707 + } 708 + 709 + #[test] 710 + fn end_on_fullwidth() { 711 + let term = mock_term("jarrð¦"); 712 + 713 + let start = Point::new(Line(0), Column(0)); 714 + let end = Point::new(Line(0), Column(4)); 715 + 716 + // Ensure ending without a match doesn't loop indefinitely. 717 + let dfas = RegexSearch::new("x").unwrap(); 718 + assert_eq!(term.regex_search_right(&dfas, start, end), None); 719 + 720 + let dfas = RegexSearch::new("x").unwrap(); 721 + let match_end = Point::new(Line(0), Column(5)); 722 + assert_eq!(term.regex_search_right(&dfas, start, match_end), None); 723 + 724 + // Ensure match is captured when only partially inside range. 725 + let dfas = RegexSearch::new("jarrð¦").unwrap(); 726 + assert_eq!(term.regex_search_right(&dfas, start, end), Some(start..=match_end)); 701 727 } 702 728 703 729 #[test] skipped 124 lines