Opened 5 years ago
Closed 5 years ago
#15196 closed defect (fixed)
wxRichTextCell caret issues
Reported by: | dghart | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 3.0.0 |
Component: | wxRichText | Version: | stable-latest |
Keywords: | wxRichTextCell caret hittest | Cc: | |
Blocked By: | Blocking: | ||
Patch: | yes |
Description
There are two problems with the placement of the caret in a wxRichTextCell.
The first can be seen in the unmodified richtext sample (though it might need expanding so that the cells are a reasonable size). Click in any cell in the space below the text. This area doesn't seem to be recognised as part of the cell, and the caret is set outside the table.
The second can be demonstrated by first applying richtext.diff from #15189, and patch2.diff if it's not already been added. Then apply the attached richtext.diff on top: this adds SetInsertionPointEnd() to make the issue more obvious. Run richtext and click in cell 1,4. Then 'run' the About dialog to delete that column. The caret should now be placed in cell 1,5; instead it's outside the table, as can be seen in the attached screenshot.
Without the SetInsertionPointEnd() call the caret is often still misplaced, though less so. It seems to depend on the initial offset of the caret in the wxRTC: it's worse the further right it is due to earlier cells, or perhaps due to text preceding the table.
Attachments (3)
Change History (6)
Changed 5 years ago by dghart
Changed 5 years ago by dghart
comment:1 Changed 5 years ago by dghart
- Keywords hittest added
- Patch set
Changed 5 years ago by dghart
comment:2 Changed 5 years ago by juliansmart
- Status changed from new to confirmed
Hi, thanks for the patch, that is a big improvement. Now committed. I'll leave this ticket open for the 2nd problem.
comment:3 Changed 5 years ago by dghart
- Resolution set to fixed
- Status changed from confirmed to closed
The second issue turned out to be more serious than I realised. I've therefore opened a separate ticket for it, #15540, and I'll close this one.
hittest.patch contains a fix for the first problem which, afaict, was caused by wxRichTextParagraph::HitTest's lack of understanding of tables.
Both wxRichTextTable and wxRichTextCell now have their own HitTest() methods. The former works out which is the relevant cell and calls its HitTest(); and that just duplicate the code from wxRichTextBuffer::HitTest.
It doesn't solve the second issue, but that's far less annoying.