[patchew-devel] Re: [PATCH 3/6] ansi2html: create ANSI to text converter

  • From: Fam Zheng <famz@xxxxxxxxxx>
  • To: patchew-devel@xxxxxxxxxxxxx
  • Date: Tue, 6 Mar 2018 17:08:28 +0800

On Mon, 03/05 10:16, Paolo Bonzini wrote:

This converter compresses sequences involving carriage returns or backspaces,
to make them readable from an editor or mail reader.

Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 patchew/logviewer.py      | 29 ++++++++++++++++++
 patchew/settings.py       |  3 ++
 patchew/tags.py           | 19 ++++++++++++
 tests/test_ansi2html.py   | 75 
++++++++++++++++++++++++++++++++++++++++++++++-
 tests/test_custom_tags.py | 27 +++++++++++++++++
 5 files changed, 152 insertions(+), 1 deletion(-)
 create mode 100644 patchew/tags.py
 create mode 100755 tests/test_custom_tags.py

diff --git a/patchew/logviewer.py b/patchew/logviewer.py
index aa5d2bb..b84d487 100644
--- a/patchew/logviewer.py
+++ b/patchew/logviewer.py
@@ -286,6 +286,29 @@ class ANSIProcessor(object):
         self._reset_attrs()
 
 
+class ANSI2TextConverter(ANSIProcessor):
+    FF = '\u2015' * 72 + '\n'

I think \u2500 may work better? At least on my Konsole using Terminus font,
\u2015 is not at correct width (a bit too wide). ;-)

Fam

Other related posts: