From 9ab97fc74d40ef793bd4dfd1192d948d6ef344b0 Mon Sep 17 00:00:00 2001 From: Xavi Lee Date: Tue, 17 Oct 2023 19:35:19 +0800 Subject: [PATCH] fix: the situation that one word reach the max length --- scripts/update/format_doc_def.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/update/format_doc_def.py b/scripts/update/format_doc_def.py index d7c71eb..e96c6d2 100644 --- a/scripts/update/format_doc_def.py +++ b/scripts/update/format_doc_def.py @@ -27,7 +27,9 @@ def str_add_break_line(zh_str, max_length): result.append(word) current_length += len(word) else: - result.append('\n' + word) + if len(result) > 0: + result.append('\n') + result.append(word) current_length = len(word) if result and result[-1] == '、':