From 4b620efc7d6b68ef5fec96973b7720d30f3a8aad Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Sun, 4 Feb 2024 11:29:17 -0800 Subject: [PATCH] Document the behavior of find_break() --- src/vesta/chars.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vesta/chars.py b/src/vesta/chars.py index 9425f0b..b062073 100644 --- a/src/vesta/chars.py +++ b/src/vesta/chars.py @@ -208,6 +208,9 @@ def encode_text( max_cols = COLS - margin * 2 rows: Rows = [] + # Find a place to break the line at a `breaks` character that results in + # the longest row possible (up to `max_cols`). The result is a pair of + # positions: the end of the resulting row and the start of the remainder. def find_break(line: Row) -> Tuple[int, int]: end = min(len(line), max_cols) for pos in range(end, 0, -1):