Commit a64c22c8 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

richedit: Store shift-enter (keyboard) and \line (rtf) as end of row (and emit…

richedit: Store shift-enter (keyboard) and \line (rtf) as end of row (and emit \line while saving in RTF).
parent 4fb2dfc9
......@@ -411,6 +411,21 @@ void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCur
}
void ME_InsertEndRowFromCursor(ME_TextEditor *editor, int nCursor)
{
ME_Style *pStyle = ME_GetInsertStyle(editor, nCursor);
ME_DisplayItem *di;
WCHAR space = ' ';
/* FIXME no no no */
if (ME_IsSelection(editor))
ME_DeleteSelection(editor);
di = ME_InternalInsertTextFromCursor(editor, nCursor, &space, 1, pStyle,
MERF_ENDROW);
ME_SendSelChange(editor);
}
void
ME_InsertTableCellFromCursor(ME_TextEditor *editor, int nCursor)
{
......
......@@ -2960,7 +2960,10 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
{
ME_Style *style = ME_GetInsertStyle(editor, 0);
ME_SaveTempStyle(editor);
ME_InsertTextFromCursor(editor, 0, &wstr, 1, style);
if (wstr == '\r' && (GetKeyState(VK_SHIFT) & 0x8000))
ME_InsertEndRowFromCursor(editor, 0);
else
ME_InsertTextFromCursor(editor, 0, &wstr, 1, style);
ME_ReleaseStyle(style);
ME_CommitUndo(editor);
}
......
......@@ -186,6 +186,7 @@ void ME_MouseMove(ME_TextEditor *editor, int x, int y);
void ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, int nChars);
void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
const WCHAR *str, int len, ME_Style *style);
void ME_InsertEndRowFromCursor(ME_TextEditor *editor, int nCursor);
BOOL ME_ArrowKey(ME_TextEditor *ed, int nVKey, BOOL extend, BOOL ctrl);
void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC);
......
......@@ -2596,10 +2596,13 @@ static void SpecialChar (RTF_Info *info)
}
break;
}
case rtfLine:
RTFFlushOutputBuffer(info);
ME_InsertEndRowFromCursor(info->editor, 0);
break;
case rtfPage:
case rtfSect:
case rtfRow:
case rtfLine:
case rtfPar:
RTFPutUnicodeChar (info, '\n');
break;
......@@ -2648,6 +2651,7 @@ RTFFlushUnicodeOutputBuffer(RTF_Info *info)
}
}
static void
RTFPutUnicodeString(RTF_Info *info, const WCHAR *string, int length)
{
......
......@@ -714,6 +714,10 @@ ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream, int nStart, int nC
nChars--;
if (editor->bEmulateVersion10 && nChars)
nChars--;
} else if (p->member.run.nFlags & MERF_ENDROW) {
if (!ME_StreamOutPrint(pStream, "\\line \r\n"))
return FALSE;
nChars--;
} else {
int nEnd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment