Skip to content

Commit 9701b06

Browse files
committed
fix: correct operator precedence in text height estimation
1 parent f17b453 commit 9701b06

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

src/nonebot_plugin_parser/renders/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def _ensure_height_enough(self, ctx: RenderContext, needed_height: int) -> None:
229229

230230
def _estimate_text_height(self, text: str, font: FontInfo, content_width: int) -> int:
231231
"""估算文本高度(考虑换行符)"""
232-
return text.count("\n") + 1 + (len(text) * font.cjk_width // content_width) * font.line_height
232+
return (text.count("\n") + 1 + len(text) * font.cjk_width // content_width) * font.line_height
233233

234234
def _estimate_height(self, result: ParseResult, content_width: int) -> int:
235235
"""估算画布高度"""

src/nonebot_plugin_parser/utils.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515

1616

1717
class LimitedSizeDict(OrderedDict[K, V]):
18-
"""
19-
定长字典
20-
"""
21-
2218
def __init__(self, *args, max_size=20, **kwargs):
2319
self.max_size = max_size
2420
super().__init__(*args, **kwargs)

0 commit comments

Comments
 (0)