From a0ab90a4d7475045d4f8ceb557e1647d0f8a244c Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Thu, 16 Jun 2022 18:23:57 +0200 Subject: [PATCH] Avoid having an ending separator before crop marker --- milli/src/search/matches/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/milli/src/search/matches/mod.rs b/milli/src/search/matches/mod.rs index ba2e8728e..e2bde3daf 100644 --- a/milli/src/search/matches/mod.rs +++ b/milli/src/search/matches/mod.rs @@ -262,7 +262,11 @@ impl<'t, A: AsRef<[u8]>> Matcher<'t, '_, A> { (Some(before_token_kind), Some(after_token_kind)) => { if before_token_kind == after_token_kind { before_tokens.next(); - after_tokens.next(); + + // this avoid having an ending separator before crop marker. + if remaining_words > 1 { + after_tokens.next(); + } } else if before_token_kind == SeparatorKind::Hard { after_tokens.next(); } else {