From 76f0ec7b541cfa2a58f60d9f4a5f442eaa45a8b4 Mon Sep 17 00:00:00 2001 From: Gary Fixler Date: Wed, 19 Feb 2025 08:36:22 -0800 Subject: [PATCH] Fix zalgo's minimum and maximum usage The combining marks were being overwritten every loop, so only the last one in the loop was kept. Regardless of minimum and maximum, it only ever added one combining mark to each letter. I just moved the creation base letter to above the loop, and moved the adding of the fully combined form to the translations dictionary to below the loop. --- plover_fancytext/zalgo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plover_fancytext/zalgo.py b/plover_fancytext/zalgo.py index a851f5e..f9d866b 100644 --- a/plover_fancytext/zalgo.py +++ b/plover_fancytext/zalgo.py @@ -24,12 +24,12 @@ def add_combining_marks(self, c: str) -> str: if c in self.translations: return self.translations[c] + o = c for m in random.sample( COMBINING_MARKS, random.randrange(self.minimum, self.maximum)): - o = c o += m - self.translations[c] = o + self.translations[c] = o return o def format(self, str) -> str: