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 171581 - wrong line start report for an object with 'text' role
wrong line start report for an object with 'text' role
Status: RESOLVED FIXED
Product: at-spi
Classification: Platform
Component: javabridge
unspecified
Other Linux
: High normal
: ---
Assigned To: bill.haneman
bill.haneman
AP1
: 171583 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-03-25 12:35 UTC by Oana Serb
Modified: 2005-04-04 14:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to fix problem (27.80 KB, patch)
2005-03-29 13:31 UTC, bill.haneman
none Details | Review

Description Oana Serb 2005-03-25 12:35:50 UTC
Run Swing Demo.
Choose 'TextArea Two'.
The line start for the text object is -1.
Comment 1 Oana Serb 2005-03-28 09:56:42 UTC
AccessibleText_getTextAtOffset (text, offset, acc_type_text, &start, &end)
returns a negative value for 'start' parameter.
Comment 2 Oana Serb 2005-03-28 10:41:45 UTC
AccessibleText_getTextAtOffset (text, offset, SPI_TEXT_BOUNDARY_LINE_START,
&start, &end) returns a negative value for 'start' parameter if offset is placed
in the first line of a multiline text and it returns a wrong value, also,(the
good value for the start line - (minus) 1) if the offset is placed in other line.

Comment 3 Oana Serb 2005-03-29 09:11:16 UTC
The same behavior is present for SPI_TEXT_BOUNDARY_SENTENCE_START type (and
SPI_TEXT_BOUNDARY_SENTENCE_END). Wrong values will be returned for start and end
of sentence.  
Comment 4 Oana Serb 2005-03-29 12:53:34 UTC
*** Bug 171583 has been marked as a duplicate of this bug. ***
Comment 5 bill.haneman 2005-03-29 13:31:42 UTC
Created attachment 39381 [details] [review]
patch to fix problem

Oana, please report whether the attached patch to java-access-bridge solves
your problem.  It seems to solve the immediately visible brlmonitor issue, but
I haven't confirmed that it works correctly for sentences, etc.
Comment 6 Oana Serb 2005-03-30 07:45:24 UTC
The patch solves only the case for the first line. If the offset is in any other
line, except the first one, the start of the line is wrong. Also, wrong values
are obtained for start and end of sentence.
Comment 7 bill.haneman 2005-03-30 12:50:56 UTC
the rest of the bug seems to be in Java, then.
Comment 8 bill.haneman 2005-03-30 16:19:13 UTC
Try the latest cvs version of java-access-bridge; it also reports text-change
strings in the CORBA_Anys sent from the currently-focussed object.
Comment 9 Oana Serb 2005-03-31 13:58:08 UTC
With the latest version of java-access-bridge, I saw the following in Swing Demo:

- writing a text ('abcdef') in a text box, then deleting it (using 'backspace'
or 'delete') char by char, the deleted text is sometimes null and sometimes has
a wrong value.
- sometimes, when deleting a char from the text box, the 'text-changed:delete'
event is not reported (for example if I want to delete the 'f' from the 'abcdef'
string, only the 'caret-moved' event is reported).

This behavior is present for multipleline and also for singleline text boxes.

Comment 10 bill.haneman 2005-03-31 14:01:44 UTC
Oana, are you using the version that was distributed via email this afternoon? 
It should have solved the issues in comment #9 (I don't see them).  Also please
indicate which 'text box' you are using in which 'Swing Demo' - are you using
SwingSet2?  If so, which widgets are you testing?
Comment 11 Oana Serb 2005-03-31 14:12:48 UTC
All the tests were made with the cvs version. I didn't received at that time the
new version.
I used Swing Demo.
The text boxes from 'TextArea Two', 'Text Fields', 'More labels' and 'Label'
tags were used for tests.
Comment 12 Oana Serb 2005-03-31 14:15:08 UTC
I will make all the tests again with the new version.
Comment 13 Oana Serb 2005-04-01 09:19:25 UTC
I made again all the tests with the new version. The deleted text and the events
are reported correctly. The behavior shown in comment #9 is not present anymore.
Comment 14 bill.haneman 2005-04-01 09:20:49 UTC
Thanks.  However we seem to have gotten off-topic for this bug, which was about
offsets for LINE and SENTENCE.  Should we open a separate bug and put the
comments (above) there?
Comment 15 Oana Serb 2005-04-01 09:24:17 UTC
Yes, that would be great.
Comment 16 bill.haneman 2005-04-01 10:32:22 UTC
I copied comments #8 through #15 into bug 171584, which I believe is the correct
bug for this issue (text-change event strings).

So, this bug report can be only about line and sentence start/end offsets.
Comment 17 bill.haneman 2005-04-01 11:12:18 UTC
I have confirmed that sentence start/end offsets are sometimes reported
incorrectly; this may be a java-bridge bug.
Comment 18 bill.haneman 2005-04-01 12:49:17 UTC
The root cause appears to be an inconsistency in the strings reported by
AccessibleText.getAtOffest versus AccessibleText.getAfterOffset; getAfterOffset
seems to include a trailng carriage return if you're on the last line of text,
but getAtOffset never does.  This is a Java bug.  It may be possible to work
around it by detecting and stripping the trailing carriage-return. 
Comment 19 bill.haneman 2005-04-01 16:57:09 UTC
I believe this is now fixed in CVS; tests which I've carried out now report
correct start and end offsets for all but the last character in multi-line text
(that last corner case is a Java problem which may not be practical to work
around).  Please reopen if significantly wrong text offsets are observed.
Comment 20 bill.haneman 2005-04-01 16:58:04 UTC
*** Bug 171583 has been marked as a duplicate of this bug. ***
Comment 21 Oana Serb 2005-04-04 10:57:20 UTC
With the new version of java-access-bridge from cvs, the line start is not correct.
I've tested with Swing Demo, for 'TextArea Two' tab. For the description text
box ("This example shows the use..."), the start offset for the first line is
correct, but for the other lines, the start offset is not correct.
Comment 22 bill.haneman 2005-04-04 12:33:45 UTC
Oana: can you please provide some examples, with the expected correct values? 
Are you talking about an 'off by one' error?  
Comment 23 Oana Serb 2005-04-04 13:07:10 UTC
For the example from comment #21, if the carret position is on the first line in
the text box, this text will be reported on braille monitor: "This example shows
the use of...". The carret position on braille monitor is good and, also, the
reported text is correct.
If I move down, to the second line of this text box, the reported text will be:
"_editable. The accessible...", where "_" is <space>. The carret position on
braille monitor is not correct. 
In this case, the start offset for this line is wrong. (the start offset is the
good value - (minus) 1).
Comment 24 Oana Serb 2005-04-04 13:15:21 UTC
This behavior is present, also, if I write a 'multi-line' text in the empty text
box from 'TextArea Two'. (don't use <enter> to add a new text line).
Comment 25 bill.haneman 2005-04-04 14:09:12 UTC
I fixed an off-by-one problem in the getLine method in the java bridge.