riched20: Use cell ptrs in the table position to offset function.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2020-10-23 10:25:04 +01:00 committed by Alexandre Julliard
parent 2809ac2b78
commit 2c2020ddb5
1 changed files with 7 additions and 7 deletions

View File

@ -880,21 +880,21 @@ int ME_GetCursorOfs(const ME_Cursor *cursor)
/* Helper function for ME_FindPixelPos to find paragraph within tables */ /* Helper function for ME_FindPixelPos to find paragraph within tables */
static ME_Paragraph *pixel_pos_in_table_row( int x, int y, ME_Paragraph *para ) static ME_Paragraph *pixel_pos_in_table_row( int x, int y, ME_Paragraph *para )
{ {
ME_DisplayItem *cell, *next_cell; ME_Cell *cell, *next_cell;
assert( para->nFlags & MEPF_ROWSTART ); assert( para->nFlags & MEPF_ROWSTART );
cell = para_next( para )->pCell; cell = table_row_first_cell( para );
assert( cell ); assert( cell );
/* find the cell we are in */ /* find the cell we are in */
while ((next_cell = cell->member.cell.next_cell) != NULL) while ((next_cell = cell_next( cell )) != NULL)
{ {
if (x < next_cell->member.cell.pt.x) if (x < next_cell->pt.x)
{ {
para = &ME_FindItemFwd( cell, diParagraph )->member.para; para = cell_first_para( cell );
/* Found the cell, but there might be multiple paragraphs in /* Found the cell, but there might be multiple paragraphs in
* the cell, so need to search down the cell for the paragraph. */ * the cell, so need to search down the cell for the paragraph. */
while (cell == para->pCell) while (cell == para_cell( para ))
{ {
if (y < para->pt.y + para->nHeight) if (y < para->pt.y + para->nHeight)
{ {