Eric Pouech : richedit: Store shift-enter (keyboard) and \line (rtf) as end of row (and emit \line while saving in RTF).
Alexandre Julliard
julliard at winehq.org
Mon Mar 17 10:46:32 CDT 2008
Module: wine
Branch: master
Commit: a64c22c8b19767b14e2cb57eefc6df2f7d8c9602
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a64c22c8b19767b14e2cb57eefc6df2f7d8c9602
Author: Eric Pouech <eric.pouech at orange.fr>
Date: Sun Mar 16 21:46:51 2008 +0100
richedit: Store shift-enter (keyboard) and \line (rtf) as end of row (and emit \line while saving in RTF).
---
dlls/riched20/caret.c | 15 +++++++++++++++
dlls/riched20/editor.c | 5 ++++-
dlls/riched20/editor.h | 1 +
dlls/riched20/reader.c | 6 +++++-
dlls/riched20/writer.c | 4 ++++
5 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 3f0604e..adf90ac 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -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)
{
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 9288ea2..7ad8980 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -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);
}
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 8b97a55..bfcc794 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -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);
diff --git a/dlls/riched20/reader.c b/dlls/riched20/reader.c
index ebc9745..28930db 100644
--- a/dlls/riched20/reader.c
+++ b/dlls/riched20/reader.c
@@ -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)
{
diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c
index ff3f5ee..30e9c93 100644
--- a/dlls/riched20/writer.c
+++ b/dlls/riched20/writer.c
@@ -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;
More information about the wine-cvs
mailing list