Bug of EditBox's undo and redo

mos

15-03-2011 02:44:33

In the function
void EditBox::saveInHistory(VectorChangeInfo* _info)
{
if (_info == nullptr)
return;
// 械褋谢懈 薪械褌 懈薪褎芯褉屑邪褑懈懈 芯斜 懈蟹屑械薪械薪懈懈
if ( _info->empty())
return;
if ((_info->size() == 1) && (_info->back().type == TextCommandInfo::COMMAND_POSITION))
return;

+ if (mVectorUndoChangeInfo.empty())
+ mVectorRedoChangeInfo.clear();

mVectorUndoChangeInfo.push_back(*_info);
// 锌褉芯胁械褉褟械屑 薪邪 屑邪泻褋懈屑邪谢褜薪褘泄 褉邪蟹屑械褉
if (mVectorUndoChangeInfo.size() > EDIT_MAX_UNDO)
mVectorUndoChangeInfo.pop_front();
}

if you not clear the redo, the text changed and redo may be wrong.

mos

15-03-2011 02:58:20

Sorry , it should be

//if (mVectorUndoChangeInfo.empty())
mVectorRedoChangeInfo.clear();

just clear not check.

Altren

15-03-2011 21:57:59

Thank you for noticing that. There was few more places where commandResetRedo(); call was required.

Fixed in r4227.