Fix for bug #7495: [PP]Undo on Linux shows intermediate steps.

Modified Undo() and Redo() to call Begin/EndUpdateViewBatch().
This commit is contained in:
kin%netscape.com 1999-07-06 23:02:12 +00:00
Родитель 8c6b3f72a0
Коммит bc437183b9
2 изменённых файлов: 56 добавлений и 58 удалений

Просмотреть файл

@ -913,27 +913,26 @@ nsEditor::Undo(PRUint32 aCount)
if (gNoisy) { printf("Editor::Undo ----------\n"); } if (gNoisy) { printf("Editor::Undo ----------\n"); }
nsresult result = NS_OK; nsresult result = NS_OK;
nsCOMPtr<nsIDOMSelection>selection;
nsresult selectionResult = GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(selectionResult) && selection) {
selection->StartBatchChanges();
if ((nsITransactionManager *)nsnull!=mTxnMgr.get())
{
PRUint32 i=0;
for ( ; i<aCount; i++)
{
result = mTxnMgr->Undo();
if (NS_SUCCEEDED(result)) BeginUpdateViewBatch();
result = DoAfterUndoTransaction();
if ((nsITransactionManager *)nsnull!=mTxnMgr.get())
{
PRUint32 i=0;
for ( ; i<aCount; i++)
{
result = mTxnMgr->Undo();
if (NS_SUCCEEDED(result))
result = DoAfterUndoTransaction();
if (NS_FAILED(result)) if (NS_FAILED(result))
break; break;
}
} }
selection->EndBatchChanges();
} }
EndUpdateViewBatch();
return result; return result;
} }
@ -949,22 +948,22 @@ nsEditor::Redo(PRUint32 aCount)
if (gNoisy) { printf("Editor::Redo ----------\n"); } if (gNoisy) { printf("Editor::Redo ----------\n"); }
nsresult result = NS_OK; nsresult result = NS_OK;
nsCOMPtr<nsIDOMSelection>selection;
nsresult selectionResult = GetSelection(getter_AddRefs(selection)); BeginUpdateViewBatch();
if (NS_SUCCEEDED(selectionResult) && selection) {
selection->StartBatchChanges(); if ((nsITransactionManager *)nsnull!=mTxnMgr.get())
if ((nsITransactionManager *)nsnull!=mTxnMgr.get()) {
PRUint32 i=0;
for ( ; i<aCount; i++)
{ {
PRUint32 i=0; result = mTxnMgr->Redo();
for ( ; i<aCount; i++) if (NS_FAILED(result))
{ break;
result = mTxnMgr->Redo();
if (NS_FAILED(result))
break;
}
} }
selection->EndBatchChanges();
} }
EndUpdateViewBatch();
return result; return result;
} }

Просмотреть файл

@ -913,27 +913,26 @@ nsEditor::Undo(PRUint32 aCount)
if (gNoisy) { printf("Editor::Undo ----------\n"); } if (gNoisy) { printf("Editor::Undo ----------\n"); }
nsresult result = NS_OK; nsresult result = NS_OK;
nsCOMPtr<nsIDOMSelection>selection;
nsresult selectionResult = GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(selectionResult) && selection) {
selection->StartBatchChanges();
if ((nsITransactionManager *)nsnull!=mTxnMgr.get())
{
PRUint32 i=0;
for ( ; i<aCount; i++)
{
result = mTxnMgr->Undo();
if (NS_SUCCEEDED(result)) BeginUpdateViewBatch();
result = DoAfterUndoTransaction();
if ((nsITransactionManager *)nsnull!=mTxnMgr.get())
{
PRUint32 i=0;
for ( ; i<aCount; i++)
{
result = mTxnMgr->Undo();
if (NS_SUCCEEDED(result))
result = DoAfterUndoTransaction();
if (NS_FAILED(result)) if (NS_FAILED(result))
break; break;
}
} }
selection->EndBatchChanges();
} }
EndUpdateViewBatch();
return result; return result;
} }
@ -949,22 +948,22 @@ nsEditor::Redo(PRUint32 aCount)
if (gNoisy) { printf("Editor::Redo ----------\n"); } if (gNoisy) { printf("Editor::Redo ----------\n"); }
nsresult result = NS_OK; nsresult result = NS_OK;
nsCOMPtr<nsIDOMSelection>selection;
nsresult selectionResult = GetSelection(getter_AddRefs(selection)); BeginUpdateViewBatch();
if (NS_SUCCEEDED(selectionResult) && selection) {
selection->StartBatchChanges(); if ((nsITransactionManager *)nsnull!=mTxnMgr.get())
if ((nsITransactionManager *)nsnull!=mTxnMgr.get()) {
PRUint32 i=0;
for ( ; i<aCount; i++)
{ {
PRUint32 i=0; result = mTxnMgr->Redo();
for ( ; i<aCount; i++) if (NS_FAILED(result))
{ break;
result = mTxnMgr->Redo();
if (NS_FAILED(result))
break;
}
} }
selection->EndBatchChanges();
} }
EndUpdateViewBatch();
return result; return result;
} }