[orca] fix for bgo#620018 - By reformatting a text or comment in eclipse, Orca speaks all the file contents



commit eb2a2e566523e94e247b53bc20b6d41ca78d4269
Author: José Vilmar Estácio de Souza <vilmar informal com br>
Date:   Mon Jun 21 15:34:48 2010 -0300

    fix for bgo#620018 - By reformatting a text or comment in eclipse, Orca speaks all the file contents
    
    In the function onTextInserted, the event is discarded if  event.detail1 is
    equals to 0 and event.detail2 is equals to
    event.source.queryText().characterCount. When the text is reformated or
    when a comment block is inserted, eclipse reinsert all the text but set
    detail1 to 0 and detail2 to the length of the new text.

 src/orca/scripts/apps/Eclipse/script.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/apps/Eclipse/script.py b/src/orca/scripts/apps/Eclipse/script.py
index f4a0da4..b3ee03d 100644
--- a/src/orca/scripts/apps/Eclipse/script.py
+++ b/src/orca/scripts/apps/Eclipse/script.py
@@ -97,6 +97,13 @@ class Script(default.Script):
         - event: the Event
         """
 
+        length = event.source.queryText().characterCount
+        if event.detail1 == 0 and event.detail2 == length:
+            # seems to be generated by a reformat (ctrl+shift+f)
+            # or by commenting some block (ctrl+/).
+            # if not discarded, orca will speak all the text of the file.
+            return
+
         # Let the default script's normal behavior do its thing
         #
         default.Script.onTextInserted(self, event)



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