From f865612667d090b584c1ea6cc20f32fcffd828d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 15 Jun 2021 08:40:23 +0200 Subject: [PATCH] vt: utf8-print: check base character before count when looking for existing compose chain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Count is more likely to be the same for many chains. Thus we’re likely to fail sooner by checking the base character first. --- vt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vt.c b/vt.c index b99b4fef..c2e72e71 100644 --- a/vt.c +++ b/vt.c @@ -697,10 +697,10 @@ action_utf8_print(struct terminal *term, wchar_t wc) for (size_t i = 0; i < term->composed_count; i++) { const struct composed *cc = &term->composed[i]; - if (cc->count != wanted_count) + if (cc->chars[0] != base) continue; - if (cc->chars[0] != base) + if (cc->count != wanted_count) continue; bool match = true;