After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 473009 - Cannot arrow to the end of an HTML entry if Orca is controlling the caret
Cannot arrow to the end of an HTML entry if Orca is controlling the caret
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: general
2.19.x
Other All
: Normal normal
: 2.22.0
Assigned To: Joanmarie Diggs (IRC: joanie)
Orca Maintainers
Depends on:
Blocks: 404403
 
 
Reported: 2007-09-03 01:46 UTC by Joanmarie Diggs (IRC: joanie)
Modified: 2008-07-22 19:32 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
take 1 (2.28 KB, patch)
2007-12-04 07:41 UTC, Joanmarie Diggs (IRC: joanie)
reviewed Details | Review
take 2 (do what Mike and Will said) :-) (3.99 KB, patch)
2007-12-05 19:03 UTC, Joanmarie Diggs (IRC: joanie)
none Details | Review
adjustment for multiline entries (4.18 KB, patch)
2007-12-11 16:16 UTC, Joanmarie Diggs (IRC: joanie)
committed Details | Review

Description Joanmarie Diggs (IRC: joanie) 2007-09-03 01:46:53 UTC
This is a tracking bug for the following Mozilla bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=394689
cannot use setCaretOffset() to position caret at end of HTML entry
Comment 1 Joanmarie Diggs (IRC: joanie) 2007-09-20 18:59:00 UTC
The bug in question has been marked as FIXED.  I was hoping that would just magically solve the issue for us.  Apparently it has not.  I'll look at this one and see if it's an easy fix.
Comment 2 Joanmarie Diggs (IRC: joanie) 2007-12-02 21:40:56 UTC
This one is going to require changes to basic caret navigation. Therefore re-targeting this one to 2.21.4.
Comment 3 Joanmarie Diggs (IRC: joanie) 2007-12-04 07:41:35 UTC
Created attachment 100167 [details] [review]
take 1

1. Orca's caret navigation model should not kick in until we're at the actual end of the entry, rather than at the second-to-last character.  This will allow us to arrow to the end, BUT:

2. If findFirstCaretContext() is then allowed to return a characterOffset of -1, we'll wind up right back at the beginning of the entry because findNextCaretInOrder() sees an offset of -1 as an indication to start at the beginning of the object.  We'd thus be just as doomed as Charlie on the MTA -- arguably more so seeing as how none of the characters on the MTA were embedded objects, and none of the characters in our entries are bearing sandwiches.  But I digress.... findFirstCaretContext() should instead return the current offset, which will enable us to escape, BUT:

3. We'll erroneously repeat the last character (i.e. the one we just arrowed past) because under the circumstances sayCharacter() decrements the characterOffset before asking speakCharacterAtOffset() to do its thing. So we should prevent it from doing so,  BUT:

4. That will cause speakCharacterAtOffset() to just speak the entire component (in this case the full entry) for want of an actual character.  We don't have an actual character though, and we probably should say something, so why not say "blank"?

Happily the patch is shorter than the explanation. ;-)  Given that it's entirely limited to entries, I think it's pretty safe.  Thoughts on the approach?
Comment 4 Willie Walker 2007-12-04 22:56:58 UTC
I think this patch looks OK, though the first two diffs need some documentation.  The first part already has a big humongous TODO from WDW (who me?) that seems to be addressed at least partly by this patch, so maybe it should be replaced with more up-to-date comments with this patch?

For the second diff, I'm confused about the need for the change:

-            elif caretOffset >= length - 1 \
+            elif caretOffset == length \

Does this have an impact on the fix?

For the last diff, we need Mike's input. From what I can tell, it seems like it is speaking "blank" at the end of the text entry, when I think "blank" is meant to indicate you are on a blank line.
Comment 5 Mike Pedersen 2007-12-04 23:13:32 UTC
In Gedit if we arrow beyond the last space on a line we here nothing.  Perhaps we should do the same here. 
Comment 6 Joanmarie Diggs (IRC: joanie) 2007-12-05 00:15:17 UTC
> For the second diff, I'm confused about the need for the change:
> 
> -            elif caretOffset >= length - 1 \
> +            elif caretOffset == length \
> 
> Does this have an impact on the fix?

Actually, that *is* the fix. ;-)  Or perhaps more accurately, that was the only change necessary to enable us to be able to arrow to the end of the HTML entry: We were stopping too short.  The rest of the patch is about doing the right thing in terms of being able to exit the entry and say what we should.

Given an entry with the word "foo" in it (sans quotes):

f o o
^ ^ ^    length == 3 
0 1 2

When we're at offset 2 and attempt to right arrow past it to the end of the entry, caretOffset == length - 1, thus weHandleIt becomes True.  And we don't do a very good job of handling it:  We decide we're done with the entry and move on.

My understanding of this section of code is that it's our bailing mechanism:  If we're at the end of an entry (as evidenced by caretOffset == length) and press Down or Right, we want our caret navigation mechanism to kick in so that we can proceed to the next object.  Otherwise we don't want to handleIt.  I suppose >= is safer than == however.  While I couldn't cause the offset to exceed the length, we've seen far weirder things and offsets in FF3 :-)

All of this said, this was a "wee hours" fix, and I'm still sleep deprived. :-)  So if I'm missing something, please let me know.  Otherwise, I'll change the == to a >=, add some docs, and remove the speaking of "blank."

Thanks guys!!
Comment 7 Willie Walker 2007-12-05 16:57:20 UTC
(In reply to comment #6)
> > For the second diff, I'm confused about the need for the change:
> > 
> > -            elif caretOffset >= length - 1 \
> > +            elif caretOffset == length \
> > 
> > Does this have an impact on the fix?
> 
> Actually, that *is* the fix. ;-)
...
> My understanding of this section of code is that it's our bailing mechanism: 
> If we're at the end of an entry (as evidenced by caretOffset == length) and
> press Down or Right, we want our caret navigation mechanism to kick in so that
> we can proceed to the next object.  Otherwise we don't want to handleIt.  I
> suppose >= is safer than == however.  While I couldn't cause the offset to
> exceed the length, we've seen far weirder things and offsets in FF3 :-)
...
>  So if I'm missing something, please let me know.  Otherwise, I'll change the
> == to a >=, add some docs, and remove the speaking of "blank."

Gotcha.  For being just a little more on the anal side, we might consider "elif characterOffset >= length" to be just a little more consistent with what the code used to me.  Getting rid of the "blank" is Mike's call, which I think he called.  :-)

Thanks for your work.
Comment 8 Joanmarie Diggs (IRC: joanie) 2007-12-05 19:03:34 UTC
Created attachment 100334 [details] [review]
take 2 (do what Mike and Will said) :-)

Added docs/updated comments, changed the elif, took out the speaking of "blank."

Mike please test.
Comment 9 Mike Pedersen 2007-12-10 19:18:32 UTC
A problem I'm noticing is the following:
1.  reply to a comment on a bug in bugzilla.
2.  right arrow through the comment.
3.  up arrow back to the top of the comment
4.  arrow down to the bottom of the comment.
You should notice that both with down arrow and right arrow you can't move beyond the end of the comment.  On a brighter note you can now read the character at the end of an entry and we are now speaking nothing instead of blank.
Comment 10 Joanmarie Diggs (IRC: joanie) 2007-12-11 16:16:24 UTC
Created attachment 100769 [details] [review]
adjustment for multiline entries

So *that's* what that length - 1 bit was all about.... :-) 

This version does length - int(not singleLine) instead and seems to let us bail out of both single-line and multi-line entries.

Mike please test.
Comment 11 Mike Pedersen 2007-12-11 18:33:26 UTC
(In reply to comment #10)
> Created an attachment (id=100769) [edit]
> adjustment for multiline entries
> 
> So *that's* what that length - 1 bit was all about.... :-) 
> 
> This version does length - int(not singleLine) instead and seems to let us bail
> out of both single-line and multi-line entries.
> 
> Mike please test.
> 
Works great now 

Comment 12 Joanmarie Diggs (IRC: joanie) 2007-12-11 19:05:57 UTC
Will, okay to commit?
Comment 13 Willie Walker 2007-12-11 19:27:41 UTC
The mods look simple enough.  As long as it seems to work OK and it pylints to a 10.00, please commit!  :-)  Thanks for your work!
Comment 14 Joanmarie Diggs (IRC: joanie) 2007-12-11 21:06:54 UTC
Pylinted, committed, moving to pending.
Comment 15 Mike Pedersen 2007-12-11 21:56:16 UTC
(In reply to comment #14)
> Pylinted, committed, moving to pending.
> 
seems to work great 
Comment 16 Joanmarie Diggs (IRC: joanie) 2007-12-11 23:31:18 UTC
Thanks Mike.  Closing as FIXED.