richedit: Fixed the call to the EditWordBreakProc.
This commit is contained in:
parent
00fd6b62d3
commit
503972980e
|
@ -304,6 +304,8 @@ ME_WordBreakProc(LPWSTR s, INT start, INT len, INT code)
|
|||
/* FIXME: Native also knows about punctuation */
|
||||
TRACE("s==%s, start==%d, len==%d, code==%d\n",
|
||||
debugstr_wn(s, len), start, len, code);
|
||||
/* convert number of bytes to number of characters. */
|
||||
len /= sizeof(WCHAR);
|
||||
switch (code)
|
||||
{
|
||||
case WB_ISDELIMITER:
|
||||
|
@ -330,11 +332,23 @@ ME_WordBreakProc(LPWSTR s, INT start, INT len, INT code)
|
|||
int
|
||||
ME_CallWordBreakProc(ME_TextEditor *editor, ME_String *str, INT start, INT code)
|
||||
{
|
||||
/* FIXME: ANSIfy the string when bEmulateVersion10 is TRUE */
|
||||
if (!editor->pfnWordBreak)
|
||||
return ME_WordBreakProc(str->szData, start, str->nLen, code);
|
||||
else
|
||||
return editor->pfnWordBreak(str->szData, start, str->nLen, code);
|
||||
if (!editor->pfnWordBreak) {
|
||||
return ME_WordBreakProc(str->szData, start, str->nLen*sizeof(WCHAR), code);
|
||||
} else if (!editor->bEmulateVersion10) {
|
||||
/* MSDN lied about the third parameter for EditWordBreakProc being the number
|
||||
* of characters, it is actually the number of bytes of the string. */
|
||||
return editor->pfnWordBreak(str->szData, start, str->nLen*sizeof(WCHAR), code);
|
||||
} else {
|
||||
int result;
|
||||
int buffer_size = WideCharToMultiByte(CP_ACP, 0, str->szData, str->nLen,
|
||||
NULL, 0, NULL, NULL);
|
||||
char *buffer = (char*)heap_alloc(buffer_size);
|
||||
WideCharToMultiByte(CP_ACP, 0, str->szData, str->nLen,
|
||||
buffer, buffer_size, NULL, NULL);
|
||||
result = editor->pfnWordBreak(str->szData, start, str->nLen, code);
|
||||
heap_free(buffer);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
LPWSTR ME_ToUnicode(BOOL unicode, LPVOID psz)
|
||||
|
|
|
@ -5652,7 +5652,7 @@ static void test_word_movement(void)
|
|||
/* one twoX|three */
|
||||
SendMessage(hwnd, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
|
||||
ok(sel_start == sel_end, "Selection should be empty\n");
|
||||
todo_wine ok(sel_start == 8, "Cursor is at %d instead of %d\n", sel_start, 8);
|
||||
ok(sel_start == 8, "Cursor is at %d instead of %d\n", sel_start, 8);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
|
@ -5671,7 +5671,7 @@ static void test_word_movement(void)
|
|||
/* one twoX|three */
|
||||
SendMessageW(hwnd, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
|
||||
ok(sel_start == sel_end, "Selection should be empty\n");
|
||||
todo_wine ok(sel_start == 8, "Cursor is at %d instead of %d\n", sel_start, 8);
|
||||
ok(sel_start == 8, "Cursor is at %d instead of %d\n", sel_start, 8);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue