mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
- Reimplementation of EM_LINELENGTH.
- Some attempt at documentation of double-linked list of ME_DisplayItem's.
This commit is contained in:
parent
7f8614bbd4
commit
ed8379d1ad
@ -1623,7 +1623,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
case EM_LINELENGTH:
|
||||
{
|
||||
ME_DisplayItem *item, *item_end;
|
||||
int nChars = 0;
|
||||
int nChars = 0, nThisLineOfs = 0, nNextLineOfs = 0;
|
||||
|
||||
if (wParam > ME_GetTextLength(editor))
|
||||
return 0;
|
||||
@ -1634,17 +1634,13 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
}
|
||||
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;
|
||||
}
|
||||
nThisLineOfs = ME_CharOfsFromRunOfs(editor, ME_FindItemFwd(item, diRun), 0);
|
||||
item_end = ME_FindItemFwd(item, diStartRow);
|
||||
if (item_end)
|
||||
nNextLineOfs = ME_CharOfsFromRunOfs(editor, ME_FindItemFwd(item_end, diRun), 0);
|
||||
else
|
||||
{
|
||||
nChars = ME_CharOfsFromRunOfs(editor, item_end, ME_StrLen(item_end->member.run.strText));
|
||||
nChars -= ME_CharOfsFromRunOfs(editor, item, 0);
|
||||
}
|
||||
nNextLineOfs = ME_FindItemFwd(item, diParagraphOrEnd)->member.para.nCharOfs-1;
|
||||
nChars = nNextLineOfs - nThisLineOfs;
|
||||
TRACE("EM_LINELENGTH(%d)==%d\n",wParam, nChars);
|
||||
return nChars;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ int ME_ReverseFindWhitespaceV(ME_String *s, int nVChar);
|
||||
/* row.c */
|
||||
ME_DisplayItem *ME_FindRowStart(ME_Context *c, ME_DisplayItem *run, int nRelPos);
|
||||
ME_DisplayItem *ME_RowStart(ME_DisplayItem *item);
|
||||
ME_DisplayItem *ME_RowEnd(ME_DisplayItem *item);
|
||||
/* ME_DisplayItem *ME_RowEnd(ME_DisplayItem *item); */
|
||||
void ME_RenumberParagraphs(ME_DisplayItem *item); /* TODO */
|
||||
ME_DisplayItem *ME_FindRowWithNumber(ME_TextEditor *editor, int nRow);
|
||||
int ME_RowNumberFromCharOfs(ME_TextEditor *editor, int nOfs);
|
||||
|
@ -161,6 +161,18 @@ typedef struct tagME_Row
|
||||
int nYPos;
|
||||
} ME_Row;
|
||||
|
||||
/* the display item list layout is like this:
|
||||
* - the document consists of paragraphs
|
||||
* - each paragraph contains at least one run, the last run in the paragraph
|
||||
* is an end-of-paragraph run
|
||||
* - each formatted paragraph contains at least one row, which corresponds
|
||||
* to a screen line (that's why there are no rows in an unformatted
|
||||
* paragraph
|
||||
* - the paragraphs contain "shortcut" pointers to the previous and the next
|
||||
* paragraph, that makes iteration over paragraphs faster
|
||||
* - the list starts with diTextStart and ends with diTextEnd
|
||||
*/
|
||||
|
||||
typedef struct tagME_DisplayItem
|
||||
{
|
||||
ME_DIType type;
|
||||
|
@ -77,12 +77,13 @@ ME_DisplayItem *ME_RowStart(ME_DisplayItem *item) {
|
||||
return ME_FindItemBackOrHere(item, diStartRow);
|
||||
}
|
||||
|
||||
/*
|
||||
ME_DisplayItem *ME_RowEnd(ME_DisplayItem *item) {
|
||||
ME_DisplayItem *item2 = ME_FindItemFwd(item, diStartRowOrParagraphOrEnd);
|
||||
if (!item2) return NULL;
|
||||
return ME_FindItemBack(item, diRun);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
ME_DisplayItem *
|
||||
ME_FindRowWithNumber(ME_TextEditor *editor, int nRow)
|
||||
|
Loading…
Reference in New Issue
Block a user