diff --git a/modules/rpgmakermvmz.py b/modules/rpgmakermvmz.py index a3e4150..5847155 100644 --- a/modules/rpgmakermvmz.py +++ b/modules/rpgmakermvmz.py @@ -549,10 +549,11 @@ def searchNames(data, pbar, context): (r"", False), (r"", False), (r"", False), - (r"", False), + (r"", True), (r"", False), (r"", False), (r"", False), + (r"", True), (r"", False), (r"\n(.*)\n", False), (r"", False), @@ -576,10 +577,19 @@ def searchNames(data, pbar, context): note = entry["note"] for regex, wordwrap in note_regexes: matches = re.findall(regex, note, re.DOTALL) - for m in matches: - match_text = m if isinstance(m, str) else m[0] - notesBatch.append(match_text) - notesBatchMap.append((idx, regex, match_text, wordwrap)) + # Special filter for to skip if 'Client' is in the match + if regex.startswith(r" str: """ if not text: return "" - - words = text.split() - lines = [] - current_line = [] - current_length = 0 - - for word in words: - # Calculate visible length ignoring color codes - word_length = _get_visible_length(word) - - # Check if adding this word would exceed the width - if current_length + word_length + len(current_line) <= width: - current_line.append(word) - current_length += word_length - else: - if current_line: # Only add line if we have words - lines.append(" ".join(current_line)) - current_line = [word] - current_length = word_length - - # Add the last line if it has any words - if current_line: - lines.append(" ".join(current_line)) - - return "\n".join(lines) \ No newline at end of file + + # Split on double newlines (\n\n or \\n\\n) + import re + segments = re.split(r'(?:\n\n|\\n\\n)', text) + wrapped_segments = [] + for segment in segments: + words = segment.split() + lines = [] + current_line = [] + current_length = 0 + for word in words: + word_length = _get_visible_length(word) + if current_length + word_length + len(current_line) <= width: + current_line.append(word) + current_length += word_length + else: + if current_line: + lines.append(" ".join(current_line)) + current_line = [word] + current_length = word_length + if current_line: + lines.append(" ".join(current_line)) + wrapped_segments.append("\n".join(lines)) + # Rejoin with double newlines to preserve hard breaks + return "\n\n".join(wrapped_segments) \ No newline at end of file