From 1cf8fea7a7ab3fe83b06b2b41c92fb7d870e21ac Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Tue, 16 Mar 2021 08:22:48 +0000 Subject: [PATCH] riched20: Use the multiline property rather than style. Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/riched20/caret.c | 4 ++-- dlls/riched20/editor.c | 20 ++++++-------------- dlls/riched20/paint.c | 4 ++-- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 6417bbde442..96765cba25d 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -99,7 +99,7 @@ int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how) length = ME_GetTextLength(editor); - if ((editor->styleFlags & ES_MULTILINE) + if ((editor->props & TXTBIT_MULTILINE) && (how->flags & GTL_USECRLF) && !editor->bEmulateVersion10) /* Ignore GTL_USECRLF flag in 1.0 emulation */ length += editor->nParagraphs - 1; @@ -549,7 +549,7 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor, int eol_len = 0; /* Check if new line is allowed for this control */ - if (!(editor->styleFlags & ES_MULTILINE)) + if (!(editor->props & TXTBIT_MULTILINE)) break; /* Find number of CR and LF in end of paragraph run */ diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index b7c07058801..559ed88ea33 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2461,7 +2461,7 @@ static BOOL handle_enter(ME_TextEditor *editor) } } - if (editor->styleFlags & ES_MULTILINE) + if (editor->props & TXTBIT_MULTILINE) { ME_Cursor cursor = editor->pCursors[0]; ME_Paragraph *para = cursor.para; @@ -3118,15 +3118,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) if (ed->props & TXTBIT_USEPASSWORD) ITextHost_TxGetPasswordChar(texthost, &ed->cPasswordMask); - if (ed->props & TXTBIT_MULTILINE) { - ed->styleFlags |= ES_MULTILINE; - ed->bWordWrap = (ed->props & TXTBIT_WORDWRAP) != 0; - } else { - ed->bWordWrap = FALSE; - } - - if (ed->props & TXTBIT_DISABLEDRAG) - ed->styleFlags |= ES_NOOLEDRAGDROP; + ed->bWordWrap = (ed->props & TXTBIT_WORDWRAP) && (ed->props & TXTBIT_MULTILINE); ed->notified_cr.cpMin = ed->notified_cr.cpMax = 0; @@ -3435,7 +3427,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, if (lParam) editor->bDialogMode = TRUE; - if (editor->styleFlags & ES_MULTILINE) + if (editor->props & TXTBIT_MULTILINE) code |= DLGC_WANTMESSAGE; if (!(editor->props & TXTBIT_SAVESELECTION)) code |= DLGC_HASSETSEL; @@ -3784,7 +3776,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, } case EM_LINESCROLL: { - if (!(editor->styleFlags & ES_MULTILINE)) + if (!(editor->props & TXTBIT_MULTILINE)) return FALSE; ME_ScrollDown( editor, lParam * get_default_line_height( editor ) ); return TRUE; @@ -4579,7 +4571,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, case EM_SETTARGETDEVICE: if (wParam == 0) { - BOOL new = (lParam == 0 && (editor->styleFlags & ES_MULTILINE)); + BOOL new = (lParam == 0 && (editor->props & TXTBIT_MULTILINE)); if (editor->nAvailWidth || editor->bWordWrap != new) { editor->bWordWrap = new; @@ -4588,7 +4580,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, } } else { int width = max(0, lParam); - if ((editor->styleFlags & ES_MULTILINE) && + if ((editor->props & TXTBIT_MULTILINE) && (!editor->bWordWrap || editor->nAvailWidth != width)) { editor->nAvailWidth = width; diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 34d0ab8a54f..8ef5ada5855 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -1086,7 +1086,7 @@ void ME_ScrollAbs(ME_TextEditor *editor, int x, int y) bScrollBarIsVisible = (winStyle & WS_VSCROLL) != 0; bScrollBarWillBeVisible = (editor->nTotalLength > editor->sizeWindow.cy && (editor->scrollbars & WS_VSCROLL) - && (editor->styleFlags & ES_MULTILINE)) + && (editor->props & TXTBIT_MULTILINE)) || (editor->scrollbars & ES_DISABLENOSCROLL); if (bScrollBarIsVisible != bScrollBarWillBeVisible) ITextHost_TxShowScrollBar(editor->texthost, SB_VERT, @@ -1211,7 +1211,7 @@ void ME_UpdateScrollBar(ME_TextEditor *editor) /* Update vertical scrollbar */ bScrollBarWasVisible = editor->vert_si.nMax > editor->vert_si.nPage; bScrollBarWillBeVisible = editor->nTotalLength > editor->sizeWindow.cy && - (editor->styleFlags & ES_MULTILINE); + (editor->props & TXTBIT_MULTILINE); if (editor->vert_si.nPos && !bScrollBarWillBeVisible) {