gnome-terminal/VTE not sending correct selected text information to Orca



Hi Everyone,

I'm visually empaired and I'd like to contribute to the great work you do in the GNOME accessibility team. At this point I'm using the Orca screen reader. 

I noticed that in gnome-terminal the selected text is not detected by Orca when you either use the mouse to select a word, or ask Orca to read the current selected text. I could track the execution to the following Orca method: file script_utilities.py -> class Utilities -> method selectedText. There, the textObj.getSelection(i) returns both the start and end offsets with the same value, which makes the method to return immediately. 

I also noticed that using gedit or eclipse, the same method is executed, and it works great. So, I tried to understand why gnome-terminal was not providing the correct information to Orca. I believe I found a possible bug in the VTE library. In the file vteaccess.cc -> method vte_terminal_accessible_get_selection, it's calculated the stard and end offsets as follows:

*start_offset = offset_from_xy (priv, start_sel.col, start_sel.row);
*end_offset = offset_from_xy (priv, end_sel.col, end_sel.row);

However, the col and row values do not refer to the display text, but to the whole terminal buffer. I realized that based on how the snapshot_text member is set from the method get_text_displayed_a11y() on vte_terminal_accessible_update_private_data_if_needed. According to the code in get_text_displayed_a11y() I tried to adapt the offsets using the scroll_delta value as follows:

*start_offset = offset_from_xy (priv, start_sel.col, start_sel.row - impl->m_screen->scroll_delta);
*end_offset = offset_from_xy (priv, end_sel.col, end_sel.row - impl->m_screen->scroll_delta);

So far, everything looks great! BTW, I'm using Orca master, and vte2.91-0.46.1 from Debian sid/unstable. I checked the VTE master branch and the code is the same. 
Since that is the first time I'm contributing to an OpenSource project, I'd like your recomendations about how to go ahead with this fix. Of course, considering if that is really the correct way of fixing this :)

Thanks a lot, 
Juliano 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]