riched20: Make ME_StreamIn create undos properly.
This commit is contained in:
parent
7c8fdd67e4
commit
807546ee59
|
@ -597,7 +597,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
|
||||||
{
|
{
|
||||||
RTF_Info parser;
|
RTF_Info parser;
|
||||||
ME_Style *style;
|
ME_Style *style;
|
||||||
int from, to, to2, nUndoMode;
|
int from, to, to2;
|
||||||
ME_UndoItem *pUI;
|
ME_UndoItem *pUI;
|
||||||
int nEventMask = editor->nEventMask;
|
int nEventMask = editor->nEventMask;
|
||||||
ME_InStream inStream;
|
ME_InStream inStream;
|
||||||
|
@ -621,9 +621,6 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
|
||||||
/* FIXME restore default paragraph formatting ! */
|
/* FIXME restore default paragraph formatting ! */
|
||||||
}
|
}
|
||||||
|
|
||||||
nUndoMode = editor->nUndoMode;
|
|
||||||
editor->nUndoMode = umIgnore;
|
|
||||||
|
|
||||||
inStream.editstream = stream;
|
inStream.editstream = stream;
|
||||||
inStream.editstream->dwError = 0;
|
inStream.editstream->dwError = 0;
|
||||||
inStream.dwSize = 0;
|
inStream.dwSize = 0;
|
||||||
|
@ -675,16 +672,19 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
|
||||||
SendMessageA(editor->hWnd, EM_SETSEL, 0, 0);
|
SendMessageA(editor->hWnd, EM_SETSEL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
editor->nUndoMode = nUndoMode;
|
|
||||||
if (format & SFF_SELECTION)
|
if (format & SFF_SELECTION)
|
||||||
{
|
{
|
||||||
pUI = ME_AddUndoItem(editor, diUndoDeleteRun, NULL);
|
if(from < to) /* selection overwritten is non-empty */
|
||||||
TRACE("from %d to %d\n", from, to);
|
|
||||||
if (pUI && from < to)
|
|
||||||
{
|
{
|
||||||
pUI->nStart = from;
|
pUI = ME_AddUndoItem(editor, diUndoDeleteRun, NULL);
|
||||||
pUI->nLen = to-from;
|
TRACE("from %d to %d\n", from, to);
|
||||||
|
if (pUI)
|
||||||
|
{
|
||||||
|
pUI->nStart = from;
|
||||||
|
pUI->nLen = to-from;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
/* even if we didn't add an undo, we need to commit the ones added earlier */
|
||||||
ME_CommitUndo(editor);
|
ME_CommitUndo(editor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1308,10 +1308,8 @@ static void test_EM_GETMODIFY(void)
|
||||||
SendMessage(hwndRichEdit, EM_STREAMIN,
|
SendMessage(hwndRichEdit, EM_STREAMIN,
|
||||||
(WPARAM)(SF_TEXT), (LPARAM)&es);
|
(WPARAM)(SF_TEXT), (LPARAM)&es);
|
||||||
result = SendMessage(hwndRichEdit, EM_GETMODIFY, 0, 0);
|
result = SendMessage(hwndRichEdit, EM_GETMODIFY, 0, 0);
|
||||||
todo_wine {
|
|
||||||
ok (result != 0,
|
ok (result != 0,
|
||||||
"EM_GETMODIFY returned zero, instead of non-zero for EM_STREAM\n");
|
"EM_GETMODIFY returned zero, instead of non-zero for EM_STREAM\n");
|
||||||
}
|
|
||||||
|
|
||||||
DestroyWindow(hwndRichEdit);
|
DestroyWindow(hwndRichEdit);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue