Skip to content

Commit cdf30c2

Browse files
committed
setting to ignore ANSI escapes for backgrounds
The new setting "interpret_ansi_background" (boolean, defaults to False), allows to disable interpretation of ANSI escape characters that change the background colour of text.
1 parent 4b6c7a4 commit cdf30c2

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

alot/defaults/alot.rc.spec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ attachment_prefix = string(default='~')
1313
# timeout in (floating point) seconds until partial input is cleared
1414
input_timeout = float(default=1.0)
1515

16+
# display background colors set by ANSI character escapes
17+
interpret_ansi_background = boolean(default=True)
18+
1619
# confirm exit
1720
bug_on_exit = boolean(default=False)
1821

alot/widgets/ansi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self, txt,
1717
default_attr_focus,
1818
ansi_background)
1919
t = urwid.Text(ct, **kwds)
20-
attr_map = {default_attr.background: ''}
20+
attr_map = { default_attr.background: ''}
2121
w = urwid.AttrMap(t, attr_map, focus_map)
2222
urwid.WidgetWrap.__init__(self, w)
2323

alot/widgets/thread.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ def __init__(self, content, attr=None, attr_focus=None):
8585
"""
8686
structure = []
8787
for line in content.splitlines():
88+
ansi_background = settings.get("interpret_ansi_background")
8889
structure.append((ANSIText(line, attr, attr_focus,
89-
ansi_background=False), None))
90+
ansi_background), None))
9091
SimpleTree.__init__(self, structure)
9192

9293

docs/source/configuration/alotrc_table

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,16 @@
354354
:default: 1.0
355355

356356

357+
.. _interpret-ansi-background:
358+
359+
.. describe:: interpret_ansi_background
360+
361+
display background colors set by ANSI character escapes
362+
363+
:type: boolean
364+
:default: True
365+
366+
357367
.. _mailinglists:
358368

359369
.. describe:: mailinglists

0 commit comments

Comments
 (0)