diff --git a/core/decorators.py b/core/decorators.py index 56b2ead..76cb9c8 100644 --- a/core/decorators.py +++ b/core/decorators.py @@ -27,6 +27,12 @@ def scrollable(func): text = func(module, widget) if not text: return text + + if text != widget.get("__content__", text): + widget.set("scrolling.start", 0) + widget.set("scrolling.direction", "right") + widget.set("__content__", text) + width = widget.get( "theme.width", util.format.asint(module.parameter("width", 30)) ) diff --git a/tests/core/test_decorators.py b/tests/core/test_decorators.py index bbf7691..fb2878d 100644 --- a/tests/core/test_decorators.py +++ b/tests/core/test_decorators.py @@ -62,5 +62,13 @@ class config(unittest.TestCase): self.assertEqual("bc", self.module.get(self.widget)) self.assertEqual("cd", self.module.get(self.widget)) + def test_changed_data(self): + self.module.text = "abcd" + self.module.set("width", 2) + self.assertEqual("ab", self.module.get(self.widget)) + self.assertEqual("bc", self.module.get(self.widget)) + self.module.text = "wxyz" + self.assertEqual("wx", self.module.get(self.widget)) + # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4