From a6b74ad06529eb647b45670e6b10333cb793def0 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Sun, 22 Nov 2020 20:13:46 +0100 Subject: [PATCH] nicer linewrap algo for the small printer --- screenless/bureau/bureau.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/screenless/bureau/bureau.py b/screenless/bureau/bureau.py index bf72908..dc58dbe 100644 --- a/screenless/bureau/bureau.py +++ b/screenless/bureau/bureau.py @@ -94,7 +94,7 @@ class LogPrinter(logging.Handler): out_ep=self.printer["outep"]) msg = self.format(record) #text = textwrap.fill(msg, width=self.printer["textwidth"]) - spliter_regex = r'.{1,' + self.printer["textwidth"] + '}(?:\s+|$)' + spliter_regex = r'.{1,' + str(self.printer["textwidth"]) + '}(?:\s+|$)' out_text = "\r\n".join(line.strip() for line in re.findall(spliter_regex, text)) out_text += "\r\n" * 4 @@ -446,7 +446,7 @@ class Bureau(object): """ prn = self._get_small_printer() - spliter_regex = r'.{1,' + self.printer["textwidth"] + '}(?:\s+|$)' + spliter_regex = r'.{1,' + str(self.printer["textwidth"]) + '}(?:\s+|$)' out_text = "\r\n".join(line.strip() for line in re.findall(splitter_regex, text))