From b2f72930d56f50fa54c8d3c5c53e7d6c4fa1b7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Mon, 15 Jul 2024 02:06:27 +0800 Subject: [PATCH] fix --- .../LunaTranslator/rendertext/textbrowser_imp/base.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/base.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/base.py index 02bfc604..64cc47ca 100644 --- a/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/base.py +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/base.py @@ -61,14 +61,8 @@ class base(QLabel): dx, dy = self.moveoffset() text = self.text() isarabic = lambda char: (ord(char) >= 0x0600 and ord(char) <= 0x06E0) - isasciinoteng = ( - lambda char: (ord(char) <= 0x40) - or ((ord(char) >= 0x5B) and (ord(char) <= 0x60)) - or ((ord(char) >= 0x7B) and (ord(char) <= 0x7F)) - ) - isarabicx = any(isarabic(char) for char in text) and all( - (isasciinoteng(char) or isarabic(char)) for char in text - ) + isfirstara = lambda text: len(text) and isarabic(text[0]) + isarabicx = any(isarabic(char) for char in text) and isfirstara(text) if isarabicx: self.movedx -= self.width()