From d5de86672457c16d191f5c92ac7921059c3cdb16 Mon Sep 17 00:00:00 2001 From: Outlet7493 Date: Wed, 10 Jan 2024 18:07:39 +0000 Subject: [PATCH 1/2] move unicode search suggestions to regex based replacement --- lib/service.dart | 12 ++++-------- submodules/flutter | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/service.dart b/lib/service.dart index 98116113..7215b00d 100644 --- a/lib/service.dart +++ b/lib/service.dart @@ -368,14 +368,10 @@ class Service { SearchSuggestion.fromJson(handleResponse(response)); if (search.suggestions.any((element) => element.contains(";"))) { search.suggestions = search.suggestions - .map((s) => s - .replaceAll(" ", " ") - .split(";") - .where((e) => e.isNotEmpty && e.startsWith("&#")) - .map( - (e) => String.fromCharCode(int.parse(e.replaceAll("&#", "")))) - .toList() - .join("")) + .map((s) => s.replaceAll(" ", " ").replaceAllMapped( + RegExp(r"&#\w*;"), + (m) => String.fromCharCode( + int.parse(m[0]!.replaceAll(RegExp(r"&#|;"), ""))))) .toList(); } diff --git a/submodules/flutter b/submodules/flutter index b0366e0a..db7ef5bf 160000 --- a/submodules/flutter +++ b/submodules/flutter @@ -1 +1 @@ -Subproject commit b0366e0a3f089e15fd89c97604ab402fe26b724c +Subproject commit db7ef5bf9f59442b0e200a90587e8fa5e0c6336a From f7738a56641643dd3fc6faaed1e2fcce99dcdee3 Mon Sep 17 00:00:00 2001 From: Outlet7493 Date: Thu, 11 Jan 2024 11:48:52 +0000 Subject: [PATCH 2/2] format --- lib/service.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/service.dart b/lib/service.dart index 7215b00d..32eece53 100644 --- a/lib/service.dart +++ b/lib/service.dart @@ -369,9 +369,9 @@ class Service { if (search.suggestions.any((element) => element.contains(";"))) { search.suggestions = search.suggestions .map((s) => s.replaceAll(" ", " ").replaceAllMapped( - RegExp(r"&#\w*;"), + RegExp(r"&#\w*;"), (m) => String.fromCharCode( - int.parse(m[0]!.replaceAll(RegExp(r"&#|;"), ""))))) + int.parse(m[0]!.replaceAll(RegExp(r"&#|;"), ""))))) .toList(); }