From a0edd25e4388337df6e56718846dd475605a7a3e Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Thu, 21 Jul 2005 11:01:47 +0000 Subject: [PATCH] Implemented EM_LINELENGTH RichEdit message. --- dlls/riched20/editor.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 592c63ed84b..b98ded00d83 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -78,7 +78,7 @@ - EM_LIMITTEXT + EM_LINEFROMCHAR + EM_LINEINDEX - - EM_LINELENGTH + + EM_LINELENGTH + EM_LINESCROLL - EM_PASTESPECIAL - EM_POSFROMCHARS @@ -915,7 +915,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP UNSUPPORTED_MSG(EM_GETZOOM) UNSUPPORTED_MSG(EM_HIDESELECTION) UNSUPPORTED_MSG(EM_LIMITTEXT) /* also known as EM_SETLIMITTEXT */ - UNSUPPORTED_MSG(EM_LINELENGTH) UNSUPPORTED_MSG(EM_PASTESPECIAL) /* UNSUPPORTED_MSG(EM_POSFROMCHARS) missing in Wine headers */ UNSUPPORTED_MSG(EM_REQUESTRESIZE) @@ -1368,6 +1367,34 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP item = ME_FindItemFwd(item, diRun); return para->member.para.nCharOfs + item->member.run.nCharOfs; } + case EM_LINELENGTH: + { + ME_DisplayItem *item, *item_end; + int nChars = 0; + + if (wParam > ME_GetTextLength(editor)) + return 0; + if (wParam == -1) + { + FIXME("EM_LINELENGTH: returning number of unselected characters on lines with selection unsupported.\n"); + return 0; + } + item = ME_FindItemAtOffset(editor, diRun, wParam, NULL); + item = ME_RowStart(item); + item_end = ME_RowEnd(item); + if (!item_end) + { + /* Empty buffer, no runs */ + nChars = 0; + } + else + { + nChars = ME_CharOfsFromRunOfs(editor, item_end, ME_StrLen(item_end->member.run.strText)); + nChars -= ME_CharOfsFromRunOfs(editor, item, 0); + } + TRACE("EM_LINELENGTH(%d)==%d\n",wParam, nChars); + return nChars; + } case EM_FINDTEXT: { FINDTEXTA *ft = (FINDTEXTA *)lParam;