From 123d7ea6741e5ce4f846f7dcc6553b9cb26f8ee0 Mon Sep 17 00:00:00 2001 From: jmholla Date: Mon, 18 Apr 2022 15:30:58 -0400 Subject: [PATCH] Handle infinite line lengths (#61) I broke infinite lines during the rewrite. Luckily, the wrapping code is completely centralized so this one small change fixes it everywhere. --- markflow/_utils/textwrap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markflow/_utils/textwrap.py b/markflow/_utils/textwrap.py index 087873c..ab01aae 100644 --- a/markflow/_utils/textwrap.py +++ b/markflow/_utils/textwrap.py @@ -16,7 +16,7 @@ def join(split_text: List[str], leading_spaces: List[bool], width: Number) -> st potential_new_string = f"{new_split_text[-1]} {word}" else: potential_new_string = f"{new_split_text[-1]}{word}" - if len(potential_new_string) <= width or not new_split_text[-1]: + if len(potential_new_string) <= width or not new_split_text[-1] or width <= 0: new_split_text[-1] = potential_new_string else: new_split_text.append(word)