From 77963577b119d562f92a90b605b5be02aff4da10 Mon Sep 17 00:00:00 2001 From: "Peter D. Gray" Date: Thu, 22 Feb 2024 09:10:04 -0500 Subject: [PATCH] fix --- shared/utils.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/shared/utils.py b/shared/utils.py index 680a314b..3da9ea1b 100644 --- a/shared/utils.py +++ b/shared/utils.py @@ -467,14 +467,13 @@ def txtlen(s): def word_wrap(ln, w): # Generate the lines needed to wrap one line into X "width"-long lines. - # test: - # from charcodes import *; from utils import * - # list(word_wrap('Disk, press ' + KEY_NFC + ' to share via NFC, ' + KEY_QR + ' to share', 34)) - # => should be 2 lines with QR in second line + # - tests in testing/test_unit.py + + if txtlen(ln) <= w: + yield ln + return + while ln: - if txtlen(ln) <= w: - yield ln - return # find a space in (width) first part of remainder sp = ln.rfind(' ', 0, w-1)