[PATCH 1/2] riched20: Implement ITextSelection::GetText. (try 3)
Jactry Zeng
jactry92 at gmail.com
Mon Jul 21 07:27:54 CDT 2014
2014-07-21 17:21 GMT+08:00 Huw Davies <huw at codeweavers.com>:
>
>
> Sorry, one more issue. I would expect this cursor fix up needs to be
> before the invalidate call. Was there a reason you put it after?
No, you are right, I made a mistake here.
Thanks for your review!
--
Regards,
Jactry Zeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20140721/8e84b2e3/attachment.html>
-------------- next part --------------
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 90b30a2..043a32a 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -139,6 +139,7 @@ int ME_SetSelection(ME_TextEditor *editor, int from, int to)
{
ME_SetCursorToStart(editor, &editor->pCursors[1]);
ME_SetCursorToEnd(editor, &editor->pCursors[0]);
+ editor->pCursors[0].nOffset = editor->pCursors[0].pRun->member.run.len;
ME_InvalidateSelection(editor);
return len + 1;
}
@@ -159,6 +160,11 @@ int ME_SetSelection(ME_TextEditor *editor, int from, int to)
ME_GetSelectionOfs(editor, &start, &end);
if (start != end)
{
+ if (end > len)
+ {
+ editor->pCursors[0].nOffset = 0;
+ end --;
+ }
editor->pCursors[1] = editor->pCursors[0];
ME_Repaint(editor);
}
@@ -200,7 +206,12 @@ int ME_SetSelection(ME_TextEditor *editor, int from, int to)
if (editor->pCursors[1].pRun->member.run.nFlags & MERF_ENDPARA)
editor->pCursors[1].nOffset = 0;
if (editor->pCursors[0].pRun->member.run.nFlags & MERF_ENDPARA)
- editor->pCursors[0].nOffset = 0;
+ {
+ if (to > len)
+ editor->pCursors[0].nOffset = editor->pCursors[0].pRun->member.run.len;
+ else
+ editor->pCursors[0].nOffset = 0;
+ }
return to;
}
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 3bd3ec0..5ad063e 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -4363,7 +4363,9 @@ const struct exsetsel_s exsetsel_tests[] = {
{5, 10, 10, 5, 10, 0},
{15, 17, 17, 15, 17, 0},
/* test cpMax > strlen() */
- {0, 100, 18, 0, 18, 1},
+ {0, 100, 18, 0, 18, 0},
+ /* test cpMin < 0 && cpMax >= 0 after cpMax > strlen() */
+ {-1, 1, 17, 17, 17, 0},
/* test cpMin == cpMax */
{5, 5, 5, 5, 5, 0},
/* test cpMin < 0 && cpMax >= 0 (bug 4462) */
@@ -4373,13 +4375,13 @@ const struct exsetsel_s exsetsel_tests[] = {
/* test cpMin < 0 && cpMax < 0 */
{-1, -1, 17, 17, 17, 0},
{-4, -5, 17, 17, 17, 0},
- /* test cMin >=0 && cpMax < 0 (bug 6814) */
- {0, -1, 18, 0, 18, 1},
- {17, -5, 18, 17, 18, 1},
+ /* test cpMin >=0 && cpMax < 0 (bug 6814) */
+ {0, -1, 18, 0, 18, 0},
+ {17, -5, 18, 17, 18, 0},
{18, -3, 17, 17, 17, 0},
/* test if cpMin > cpMax */
- {15, 19, 18, 15, 18, 1},
- {19, 15, 18, 15, 18, 1}
+ {15, 19, 18, 15, 18, 0},
+ {19, 15, 18, 15, 18, 0},
};
static void check_EM_EXSETSEL(HWND hwnd, const struct exsetsel_s *setsel, int id) {
More information about the wine-devel
mailing list