From a186e16e86e62f7f823ace63409610b3323df8a1 Mon Sep 17 00:00:00 2001 From: Alfan Nur Fauzan Date: Fri, 27 Sep 2024 13:50:11 +0700 Subject: [PATCH] highlight to the end of word --- web-app/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web-app/src/lib.rs b/web-app/src/lib.rs index 9670bc9..8c30d0e 100644 --- a/web-app/src/lib.rs +++ b/web-app/src/lib.rs @@ -65,10 +65,10 @@ impl JsQuranize { let sura_number = self.quranize.get_sura(i).unwrap_or_default(); let aya_number = self.quranize.get_aya(i).unwrap_or_default(); let aya = self.quranize.get_quran(i).unwrap_or_default(); - let offset = match aya.get(j + quran.len()..).and_then(|s| s.chars().next()) { - Some(c @ ('\u{064B}'..'\u{0651}' | '\u{0670}')) => c.len_utf8(), - _ => 0, - }; + let offset = aya + .get(j + quran.len()..) + .and_then(|s| Some(s.split(' ').next()?.len())) + .unwrap_or_default(); let k = j + quran.len() + offset; JsLocation { sura_number,