On Sat, Jul 19, 2014 at 01:08:19AM +0800, Jactry Zeng wrote:
Hi Huw,
Is this the right way?
@@ -199,7 +205,9 @@ int ME_SetSelection(ME_TextEditor *editor, int from, int to) /* Selection is not allowed in the middle of an end paragraph run. */ 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)
- if (editor->pCursors[0].pRun->member.run.nFlags & MERF_ENDPARA && to > len)
- editor->pCursors[0].nOffset = editor->pCursors[0].pRun->member.run.len;
- else if (editor->pCursors[0].pRun->member.run.nFlags & MERF_ENDPARA) editor->pCursors[0].nOffset = 0; return to;
}
Looks ok apart from this last hunk. It would be cleaner to test the nFlags once and have a nested if/else for the to > len case.
Huw.