Restrict dialogue line symbols
This commit is contained in:
+10
-1
@@ -40,7 +40,7 @@ from PyQt6.QtCore import QCoreApplication, QMimeData, QUrl
|
||||
from PyQt6.QtGui import QAction, QDesktopServices, QFont, QFontDatabase, QFontInfo
|
||||
from PyQt6.QtWidgets import QMenu, QMenuBar, QWidget
|
||||
|
||||
from novelwriter.constants import nwConst, nwLabels, nwUnicode, trConst
|
||||
from novelwriter.constants import nwConst, nwLabels, nwQuotes, nwUnicode, trConst
|
||||
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
|
||||
from novelwriter.error import logException
|
||||
|
||||
@@ -298,6 +298,15 @@ def uniqueCompact(text: str) -> str:
|
||||
return "".join(sorted(set(compact(text))))
|
||||
|
||||
|
||||
def processDialogSymbols(symbols: str) -> str:
|
||||
"""Process dialogue line symbols."""
|
||||
result = ""
|
||||
for c in uniqueCompact(symbols):
|
||||
if c in nwQuotes.ALLOWED:
|
||||
result += c
|
||||
return result
|
||||
|
||||
|
||||
def elide(text: str, length: int) -> str:
|
||||
"""Elide a piece of text to a maximum length."""
|
||||
if len(text) > (cut := max(4, length)):
|
||||
|
||||
Reference in New Issue
Block a user