From e5b0ed75757adacdf75d20fe0011cac4b3e55978 Mon Sep 17 00:00:00 2001 From: webbrain-one <295484252+webbrain-one@users.noreply.github.com> Date: Tue, 18 Aug 2026 05:26:09 +0300 Subject: [PATCH] Fix AutofitText line wrapping Keep numeric labels and percentage symbols on one line. --- src/mpl_extra/AutofitText.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mpl_extra/AutofitText.py b/src/mpl_extra/AutofitText.py index fa09fd6..935627b 100644 --- a/src/mpl_extra/AutofitText.py +++ b/src/mpl_extra/AutofitText.py @@ -306,7 +306,7 @@ def _split_words(self, txt): """Split a hybrid sentence with some CJK characters into a list of words, keeping the English words not to be broken. """ - regex = r"[\u4e00-\ufaff]|[0-9]+|[a-zA-Z]+\'*[a-z]*" + regex = r"[\u4e00-\ufaff]|[0-9]+(?:\.[0-9]+)?%?|[a-zA-Z]+\'*[a-z]*" matches = re.findall(regex, txt, re.UNICODE) return matches