From d77214aaa0af8326bf421889494756dc001b6064 Mon Sep 17 00:00:00 2001 From: "M. Bahoosh" <12122474+the-moisrex@users.noreply.github.com> Date: Mon, 30 Dec 2024 05:08:20 -1000 Subject: [PATCH] Making the hole bigger; #576 --- webpp/unicode/normalization.hpp | 2 +- webpp/unicode/utf_reducer.hpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/webpp/unicode/normalization.hpp b/webpp/unicode/normalization.hpp index 74f30efe..22d64b3a 100644 --- a/webpp/unicode/normalization.hpp +++ b/webpp/unicode/normalization.hpp @@ -617,7 +617,7 @@ namespace webpp::unicode { if (prev_ccc < ccc && replaced_cp != replacement_char) { // found a composition of cp1 and cp2 cp1 = replaced_cp; - hole.mark_code_point(cp2_pin.iter(), reducer.end()); + hole.append_code_point(cp2_pin.iter(), reducer.end(), reducer.all_pins()); continue; } if (ccc == 0) [[likely]] { diff --git a/webpp/unicode/utf_reducer.hpp b/webpp/unicode/utf_reducer.hpp index d7647113..a833f4ff 100644 --- a/webpp/unicode/utf_reducer.hpp +++ b/webpp/unicode/utf_reducer.hpp @@ -324,6 +324,14 @@ namespace webpp::unicode { this->append(other, iters); } + template + constexpr void append_code_point(IterT start, IterT str_end, IterableT& iters) noexcept { + auto const end = + stl::next(start, checked::code_point_length(start, str_end)); + utf_range_marker other(start, end); + this->append(other, iters); + } + constexpr void clear() noexcept { beginp = endp = IterT{}; } @@ -351,6 +359,10 @@ namespace webpp::unicode { // do nothing } + constexpr void append_code_point([[maybe_unused]] auto&&... args) noexcept { + // do nothing + } + [[nodiscard]] constexpr bool empty() const noexcept { return true; }