From eb9849391c600bb5de30cec73203df087d7ec2cf 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: Sun, 24 Mar 2024 19:09:10 +0800 Subject: [PATCH] fix --- LunaTranslator/LunaTranslator/gui/textbrowser.py | 8 +------- LunaTranslator/LunaTranslator/gui/translatorUI.py | 6 +++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/textbrowser.py b/LunaTranslator/LunaTranslator/gui/textbrowser.py index e66d3f82..d51ff606 100644 --- a/LunaTranslator/LunaTranslator/gui/textbrowser.py +++ b/LunaTranslator/LunaTranslator/gui/textbrowser.py @@ -363,9 +363,6 @@ class Textbrowser( ): wwww=self.parent.width() for word in x: idx+=1 - if word['orig']=='\n': - guesslinehead=None - continue l=len(word['orig']) tl1=self.textbrowser.cursorRect(self.textcursor).topLeft() @@ -526,8 +523,6 @@ class Textbrowser( ): x=self.nearmerge(x,pos,fonthira,fontorig) self.settextposcursor(pos) for word in x: - if word['orig']=='\n': - continue l=len(word['orig']) tl1=self.textbrowser.cursorRect(self.textcursor).topLeft() @@ -562,8 +557,7 @@ class Textbrowser( ): word['hira_w']=_metrichira.width(word['hira']) #print(word['hira'],word['hira_w']) newline.append(word) - if word['orig']=='\n': - continue + l=len(word['orig']) tl1=self.textbrowser.cursorRect(self.textcursor).topLeft() self.settextposcursor(pos+l) diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index 35ec720a..306cef1e 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -169,7 +169,11 @@ class QUnFrameWindow(resizableframeless): return text=self.cleartext(text) if hira: - hira=self.parsehira(text) + hiras=[self.parsehira(_) for _ in text.split('\n')] + hira=[] + for i,_h in enumerate(hiras): + if i: hira+=[{'orig':'\n','hira':'\n'}] + hira+=_h else: hira=[] self.translate_text.setnextfont(origin)