diff --git a/LunaTranslator/LunaTranslator/cishu/mdict.py b/LunaTranslator/LunaTranslator/cishu/mdict.py index 2938b0a9..b84a21a5 100644 --- a/LunaTranslator/LunaTranslator/cishu/mdict.py +++ b/LunaTranslator/LunaTranslator/cishu/mdict.py @@ -2378,7 +2378,6 @@ class mdict(cishubase): return parsed_strings def parseashtml(self, item): - item = item.replace("\r\n", "
") items = self.parse_strings(item) html = "" for type_, string in items: @@ -2402,6 +2401,8 @@ class mdict(cishubase): if (not ishtml) and not string.endswith("
"): html += "
" + if not ishtml: + item = item.replace("\r\n", "
") return html def dfstyle(self): diff --git a/LunaTranslator/LunaTranslator/gui/transhist.py b/LunaTranslator/LunaTranslator/gui/transhist.py index a89602c7..4ba29f55 100644 --- a/LunaTranslator/LunaTranslator/gui/transhist.py +++ b/LunaTranslator/LunaTranslator/gui/transhist.py @@ -1,8 +1,7 @@ from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QTabWidget, QTextBrowser, QAction, QMenu, QFileDialog from PyQt5.QtCore import Qt, pyqtSignal -import qtawesome, functools - +import qtawesome, functools, winsharedutils from gui.usefulwidget import closeashidewindow from myutils.config import globalconfig, _TR @@ -46,10 +45,13 @@ class transhist(closeashidewindow): menu = QMenu(self) qingkong = QAction(_TR("清空")) baocun = QAction(_TR("保存")) + copy = QAction(_TR("复制到剪贴板")) hideshowraw = QAction(_TR("显示原文" if self.hiderawflag else "不显示原文")) hideshowapi = QAction(_TR("显示api" if self.hideapiflag else "不显示api")) menu.addAction(qingkong) menu.addAction(baocun) + if len(self.textOutput.textCursor().selectedText()): + menu.addAction(copy) if flag == 1: menu.addAction(hideshowraw) menu.addAction(hideshowapi) @@ -57,6 +59,8 @@ class transhist(closeashidewindow): action = menu.exec(self.mapToGlobal(p)) if action == qingkong: tb.clear() + elif action == copy: + winsharedutils.clipboard_set(self.textOutput.textCursor().selectedText()) elif action == baocun: ff = QFileDialog.getSaveFileName(self, directory="save.txt") if ff[0] == "":