From 4c2eedb1556ae705e352e286abc91294ce234b8c Mon Sep 17 00:00:00 2001 From: duncathan Date: Tue, 11 Jan 2022 21:54:58 -0600 Subject: [PATCH] maybe fix text wrapping in hints --- caver/patcher.py | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/caver/patcher.py b/caver/patcher.py index c7c59f8..a3cb606 100644 --- a/caver/patcher.py +++ b/caver/patcher.py @@ -3,7 +3,7 @@ from typing import Callable, Optional from lupa import LuaRuntime import logging import shutil -import re +import textwrap import sys import pre_edited_cs @@ -116,28 +116,11 @@ def create_hint_script(text: str, facepic: bool, ending: str) -> str: """ hard_limit = 35 msgbox_limit = 26 if facepic else hard_limit - pattern = r' [^ ]*$' - line1, line2, line3 = "", "", "" - - split = 0 - line1 = text[split:split+msgbox_limit] - - match = next(re.finditer(pattern, line1), None) - if match is not None and len(text) > msgbox_limit: - line1 = line1[:match.start(0)] - split += match.start(0)+1 - if split % hard_limit != 0: - line2 = "\r\n" - line2 += text[split:split+msgbox_limit] - - match = next(re.finditer(pattern, line2), None) - if match is not None and len(text) > msgbox_limit*2: - line2 = line2[:match.start(0)] - if split % hard_limit != 0: - split -= 2 - split += match.start(0)+1 - if split % hard_limit != 0: - line3 = "\r\n" - line3 += text[split:split+msgbox_limit] - return f"