Closed
Bug 893166
Opened 11 years ago
Closed 11 years ago
getTextBeforeOffset line end fails on wrapped lines
Categories
(Core :: Disability Access APIs, defect)
Core
Disability Access APIs
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: surkov, Assigned: surkov)
References
(Blocks 1 open bug)
Details
(Keywords: access)
Attachments
(2 files)
6.52 KB,
patch
|
tbsaunde
:
review+
|
Details | Diff | Splinter Review |
1.41 KB,
patch
|
tbsaunde
:
review+
|
Details | Diff | Splinter Review |
not super nice, obviously doesn't address all related problems, I bet there's similar thing for getTextAfterOffset, we just don't have a proper test. I want to simplify atCaretOffset text testing to add more tests and I need to fix this todo for this. Later I think we will come up with some nicer code.
Attachment #774867 -
Flags: review?(trev.saunders)
Comment 1•11 years ago
|
||
Comment on attachment 774867 [details] [diff] [review] patch it seems like layout should be able to tell you what you need here with much less work, but this is probably fine for now. > *aEndOffset = FindLineBoundary(offset, ePrevLineEnd); >- *aStartOffset = FindLineBoundary(*aEndOffset, ePrevLineEnd); >+ int32_t tmpOffset = // adjust offset if line is wrapped >+ (*aEndOffset == 0 || IsTerminalCharAt(*aEndOffset)) ? >+ *aEndOffset : *aEndOffset - 1; this pretty funny especially the comment not on its own line. maybe int tmp = *aEndOffset = = FindLineBoundary(); // hnalde soft line break blah blah if (blah blah) tmp -= 1; >+ bool IsTerminalCharAt(int32_t aOffset) IsLineEndChar() would be more clear to me, terminal could mean all sorts of things \n \r \f \0 and probably other things
Attachment #774867 -
Flags: review?(trev.saunders) → review+
Assignee | ||
Comment 2•11 years ago
|
||
(In reply to Trevor Saunders (:tbsaunde) from comment #1) > Comment on attachment 774867 [details] [diff] [review] > patch > > it seems like layout should be able to tell you what you need here with much > less work, but this is probably fine for now. same thinking but layout itself relies on \n character (for example http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsTextFrameThebes.cpp#1490) > > *aEndOffset = FindLineBoundary(offset, ePrevLineEnd); > >- *aStartOffset = FindLineBoundary(*aEndOffset, ePrevLineEnd); > >+ int32_t tmpOffset = // adjust offset if line is wrapped > >+ (*aEndOffset == 0 || IsTerminalCharAt(*aEndOffset)) ? > >+ *aEndOffset : *aEndOffset - 1; > > this pretty funny especially the comment not on its own line. maybe > > int tmp = *aEndOffset = = FindLineBoundary(); > // hnalde soft line break blah blah > if (blah blah) > tmp -= 1; > > >+ bool IsTerminalCharAt(int32_t aOffset) > > IsLineEndChar() would be more clear to me, terminal could mean all sorts of > things \n \r \f \0 and probably other things ok
Assignee | ||
Comment 3•11 years ago
|
||
it seems we are ok with GetTextAfterOffset lineEnd
Attachment #777918 -
Flags: review?
Assignee | ||
Updated•11 years ago
|
Attachment #777918 -
Flags: review? → review?(trev.saunders)
Updated•11 years ago
|
Attachment #777918 -
Flags: review?(trev.saunders) → review+
Assignee | ||
Comment 4•11 years ago
|
||
http://hg.mozilla.org/integration/mozilla-inbound/rev/228b12161e1d
Flags: in-testsuite+
Comment 5•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/228b12161e1d
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in
before you can comment on or make changes to this bug.
Description
•