diff options
author | Martin André <martin.andre@gmail.com> | 2023-03-28 19:14:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-28 19:14:18 +0200 |
commit | 64830ef20edc4ee2ee7b63a0923b0d337ed41107 (patch) | |
tree | 85382d8cee976835d3b8f9de3e3e151004872d1f | |
parent | 32c46239c086a1ff4658ba0ffde8ec6fa9b5646b (diff) | |
download | urwid-64830ef20edc4ee2ee7b63a0923b0d337ed41107.tar.gz |
Fix merging attributes while decomposing tag markup (#507)
Previously, nested markup could lead to corrupted output if consecutive
elements from different lists shared the same attributes, due to the
deletion of the wrong element while merging attributes.
Fixes #303.
-rw-r--r-- | urwid/tests/test_util.py | 4 | ||||
-rw-r--r-- | urwid/util.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/urwid/tests/test_util.py b/urwid/tests/test_util.py index 7e0acdb..2aae075 100644 --- a/urwid/tests/test_util.py +++ b/urwid/tests/test_util.py @@ -157,9 +157,9 @@ class TagMarkupTest(unittest.TestCase): ("simple one", "simple one", []), (('blue',"john"), "john", [('blue',4)]), (["a ","litt","le list"], "a little list", []), - (["mix",('high',[" it ",('ital',"up a")])," little"], + (["mix",[" it",('high',[" up",('ital'," a")])]," little"], "mix it up a little", - [(None,3),('high',4),('ital',4)]), + [(None, 6), ('high', 3), ('ital', 2)]), ([u"££", u"x££"], u"££x££", []), ([B("\xc2\x80"), B("\xc2\x80")], B("\xc2\x80\xc2\x80"), []), ] diff --git a/urwid/util.py b/urwid/util.py index 2e8e0d4..6173ca2 100644 --- a/urwid/util.py +++ b/urwid/util.py @@ -401,7 +401,7 @@ def _tagmarkup_recurse( tm, attr ): top_attr, top_run = al[0] if last_attr == top_attr: ral[-1] = (top_attr, last_run + top_run) - del al[-1] + del al[0] rtl += tl ral += al return rtl, ral |