diff --git a/src/commands/CmdUndo.cpp b/src/commands/CmdUndo.cpp index 4c2e6b7f7..83156410e 100644 --- a/src/commands/CmdUndo.cpp +++ b/src/commands/CmdUndo.cpp @@ -102,7 +102,7 @@ bool CmdUndo::confirm_revert(const std::vector& undo_ops) { view.set(row, 1, mods.str()); } last_uuid = op.get_uuid(); - mods.clear(); + mods = std::stringstream(); } if (op.is_create()) { diff --git a/test/undo.test.py b/test/undo.test.py index c3ce12af0..eeace9f74 100755 --- a/test/undo.test.py +++ b/test/undo.test.py @@ -27,6 +27,7 @@ import sys import os +import re import unittest # Ensure python finds the local simpletap module @@ -61,6 +62,19 @@ class TestUndo(TestCase): code, out, err = self.t("_get 1.status") self.assertEqual(out.strip(), "pending") + def test_modify_multiple_tasks(self): + """'add' then 'done' then 'undo'""" + self.t("add one") + self.t("add two") + self.t("add three") + self.t("rc.bulk=0 1,2,3 modify +sometag") + code, out, err = self.t("undo", input="y\n") + # This undo output should show one tag modification for each task, possibly with some + # modification-time updates if the modifications spanned a second boundary. + self.assertRegex( + out, + '\s+'.join([r"""[0-9a-f-]{36} (Update property 'modified' from\s+'[0-9]+' to '[0-9]+'\s+)?Add tag 'sometag'\s+Add property 'tags' with value 'sometag'"""] * 3)) + def test_undo_en_passant(self): """Verify that en-passant changes during undo are an error""" self.t("add one")