Commit 5067e0fc authored by Phil Krylov's avatar Phil Krylov Committed by Alexandre Julliard

Fixed EM_LINEINDEX handler and added EM_LINEFROMCHAR handler.

parent 30ddf739
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
- EM_SETZOOM 3.0 - EM_SETZOOM 3.0
- EM_HIDESELECTION - EM_HIDESELECTION
- EM_LIMITTEXT - EM_LIMITTEXT
- EM_LINEFROMCHAR + EM_LINEFROMCHAR
+ EM_LINEINDEX + EM_LINEINDEX
- EM_LINELENGTH - EM_LINELENGTH
+ EM_LINESCROLL + EM_LINESCROLL
...@@ -914,7 +914,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP ...@@ -914,7 +914,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
UNSUPPORTED_MSG(EM_GETZOOM) UNSUPPORTED_MSG(EM_GETZOOM)
UNSUPPORTED_MSG(EM_HIDESELECTION) UNSUPPORTED_MSG(EM_HIDESELECTION)
UNSUPPORTED_MSG(EM_LIMITTEXT) /* also known as EM_SETLIMITTEXT */ UNSUPPORTED_MSG(EM_LIMITTEXT) /* also known as EM_SETLIMITTEXT */
UNSUPPORTED_MSG(EM_LINEFROMCHAR)
UNSUPPORTED_MSG(EM_LINELENGTH) UNSUPPORTED_MSG(EM_LINELENGTH)
UNSUPPORTED_MSG(EM_PASTESPECIAL) UNSUPPORTED_MSG(EM_PASTESPECIAL)
/* UNSUPPORTED_MSG(EM_POSFROMCHARS) missing in Wine headers */ /* UNSUPPORTED_MSG(EM_POSFROMCHARS) missing in Wine headers */
...@@ -1308,37 +1307,23 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP ...@@ -1308,37 +1307,23 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
} }
return max(1, nRows); return max(1, nRows);
} }
case EM_LINEFROMCHAR:
{
if (wParam == -1)
return ME_RowNumberFromCharOfs(editor, ME_GetCursorOfs(editor, 1));
else
return ME_RowNumberFromCharOfs(editor, wParam);
}
case EM_EXLINEFROMCHAR: case EM_EXLINEFROMCHAR:
{ {
ME_DisplayItem *item = editor->pBuffer->pFirst->next; return ME_RowNumberFromCharOfs(editor, lParam);
int nOffset;
int nRow = 0;
while (item && item->member.para.next_para->member.para.nCharOfs <= lParam)
{
nRow += item->member.para.nRows;
item = ME_FindItemFwd(item, diParagraph);
}
if (item)
{
nOffset = lParam - item->member.para.nCharOfs;
item = ME_FindItemFwd(item, diRun);
while ((item = ME_FindItemFwd(item, diStartRowOrParagraph)))
{
item = ME_FindItemFwd(item, diRun);
if (item->member.run.nCharOfs > nOffset)
break;
nRow++;
}
}
return nRow;
} }
case EM_LINEINDEX: case EM_LINEINDEX:
{ {
ME_DisplayItem *item, *para; ME_DisplayItem *item, *para;
if (wParam == -1) if (wParam == -1)
item = ME_FindItemBack(editor->pCursors[1].pRun, diStartRow); item = ME_FindItemBack(editor->pCursors[0].pRun, diStartRow);
else else
item = ME_FindRowWithNumber(editor, wParam); item = ME_FindRowWithNumber(editor, wParam);
if (!item) if (!item)
......
...@@ -101,6 +101,7 @@ ME_DisplayItem *ME_RowStart(ME_DisplayItem *item); ...@@ -101,6 +101,7 @@ 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 */ void ME_RenumberParagraphs(ME_DisplayItem *item); /* TODO */
ME_DisplayItem *ME_FindRowWithNumber(ME_TextEditor *editor, int nRow); ME_DisplayItem *ME_FindRowWithNumber(ME_TextEditor *editor, int nRow);
int ME_RowNumberFromCharOfs(ME_TextEditor *editor, int nOfs);
/* run.c */ /* run.c */
ME_DisplayItem *ME_MakeRun(ME_Style *s, ME_String *strData, int nFlags); ME_DisplayItem *ME_MakeRun(ME_Style *s, ME_String *strData, int nFlags);
......
...@@ -101,3 +101,30 @@ ME_FindRowWithNumber(ME_TextEditor *editor, int nRow) ...@@ -101,3 +101,30 @@ ME_FindRowWithNumber(ME_TextEditor *editor, int nRow)
item = ME_FindItemFwd(item, diStartRow); item = ME_FindItemFwd(item, diStartRow);
return item; return item;
} }
int
ME_RowNumberFromCharOfs(ME_TextEditor *editor, int nOfs)
{
ME_DisplayItem *item = editor->pBuffer->pFirst->next;
int nRow = 0;
while (item && item->member.para.next_para->member.para.nCharOfs <= nOfs)
{
nRow += item->member.para.nRows;
item = ME_FindItemFwd(item, diParagraph);
}
if (item)
{
nOfs -= item->member.para.nCharOfs;
item = ME_FindItemFwd(item, diRun);
while ((item = ME_FindItemFwd(item, diStartRowOrParagraph)) != NULL)
{
item = ME_FindItemFwd(item, diRun);
if (item->member.run.nCharOfs > nOfs)
break;
nRow++;
}
}
return nRow;
}
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