bug fix: when applying change operations in reverse, apply their change units in reverse order

This commit is contained in:
Josh Holtrop 2017-01-15 20:58:18 -05:00
parent 0cd38f2198
commit 2e2cdfdb81

View File

@ -387,9 +387,21 @@ void Buffer::save_current_operation()
void Buffer::apply_change_operation(const ChangeOperation & change_operation, bool forward) void Buffer::apply_change_operation(const ChangeOperation & change_operation, bool forward)
{ {
for (auto change_unit : change_operation.changes) if (forward)
{ {
apply_change_unit(change_unit, forward); for (auto change_unit : change_operation.changes)
{
apply_change_unit(change_unit, forward);
}
}
else
{
for (auto i = change_operation.changes.rbegin();
i != change_operation.changes.rend();
i++)
{
apply_change_unit(*i, forward);
}
} }
} }