Index: default.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/default.py,v
retrieving revision 1.203
diff -u -r1.203 default.py
--- default.py	22 Sep 2006 00:45:41 -0000	1.203
+++ default.py	22 Sep 2006 01:16:36 -0000
@@ -48,9 +48,7 @@
 import util
 
 from orca_i18n import _                          # for gettext support
-from chnames import chnames
 from phonnames import phonnames
-from punctuation_settings import punctuation
 
 ########################################################################
 #                                                                      #
@@ -808,77 +806,6 @@
 
         return script.Script.processKeyboardEvent(self, keyboardEvent)
 
-    def _addRepeatSegment(self, segment, line):
-        """Add in the latest line segment, adjusting for repeat characters
-        and punctuation.
-
-        Arguments:
-        - segment: the segment of repeated characters.
-        - line: the current built-up line to characters to speak.
-
-        Returns: the current built-up line plus the new segment, after
-        adjusting for repeat character counts and punctuation.
-        """
-
-        style = settings.verbalizePunctuationStyle
-        isPunctChar = True
-        try:
-            level, action = punctuation[segment[0]]
-        except:
-            isPunctChar = False
-        count = len(segment)
-        if (count >= settings.repeatCharacterLimit) \
-           and (not segment[0] in string.whitespace) \
-           and (isPunctChar and (style <= level)):
-            if punctuation.has_key(segment[0]):
-                repeatChar = chnames[segment[0]]
-            else:
-                repeatChar = segment[0]
-            line += ' ' + str(count) + ' ' +  repeatChar  + " characters "
-        else:
-            line += segment
-
-        return line
-
-    def adjustForRepeats(self, line):
-        """Adjust line to include repeat character counts.
-        As some people will want this and others might not,
-        there is a setting in settings.py that determines
-        whether this functionality is enabled.
-
-        repeatCharacterLimit = <n>
-
-        If <n> is 0, then there would be no repeat characters.
-        Otherwise <n> would be the number of same characters (or more)
-        in a row that cause the repeat character count output.
-        If the value is set to 1, 2 or 3 then it's treated as if it was
-        zero. In other words, no repeat character count is given.
-
-        Arguments:
-        - line: the string to adjust for repeat character counts.
-
-        Returns: a new line adjusted for repeat character counts (if enabled).
-        """
-
-        if (len(line) < 4) or (settings.repeatCharacterLimit < 4):
-            return line
-
-        newLine = ''
-        segment = lastChar = line[0]
-
-        for i in range(1, len(line)):
-            if line[i] == lastChar:
-                segment += line[i]
-            else:
-                newLine = self._addRepeatSegment(segment, newLine)
-                segment = line[i]
-
-            lastChar = line[i]
-
-        newLine = self._addRepeatSegment(segment, newLine)
-
-        return newLine
-
     def __sayAllProgressCallback(self, context, type):
         # [[[TODO: WDW - this needs work.  Need to be able to manage
         # the monitoring of progress and couple that with both updating
@@ -938,7 +865,7 @@
             else:
                 voice = self.voices[settings.DEFAULT_VOICE]
 
-            phrase = self.adjustForRepeats(phrase)
+            phrase = util.adjustForRepeats(phrase)
             speech.speak(phrase, voice)
             util.speakTextSelectionState(obj, startOffset, endOffset)
 
@@ -963,7 +890,7 @@
 
             if settings.enableSpeechIndentation:
                 self.speakTextIndentation(obj, line)
-            line = self.adjustForRepeats(line)
+            line = util.adjustForRepeats(line)
             speech.speak(line, voice)
             util.speakTextSelectionState(obj, startOffset, endOffset)
 
@@ -989,7 +916,7 @@
         else:
             voice = self.voices[settings.DEFAULT_VOICE]
 
-        word = self.adjustForRepeats(word)
+        word = util.adjustForRepeats(word)
         speech.speak(word, voice)
         util.speakTextSelectionState(obj, startOffset, endOffset)
 
@@ -1103,7 +1030,7 @@
         else:
             voice = self.voices[settings.DEFAULT_VOICE]
 
-        word = self.adjustForRepeats(word)
+        word = util.adjustForRepeats(word)
         speech.speak(word, voice)
 
     def sayCharacter(self, obj):
@@ -1191,7 +1118,7 @@
         # Get the text for the object itself.
         #
         text = self.speechGenerator.getSpeech(orca_state.locusOfFocus, False)
-        text[0] = self.adjustForRepeats(text[0])
+        text[0] = util.adjustForRepeats(text[0])
         utterances.extend(text)
 
         # Now speak the tree node level.
@@ -2765,7 +2692,7 @@
             elif clickCount == 3:
                 self.phoneticSpellCurrentItem(string)
             else:
-                string = self.adjustForRepeats(string)
+                string = util.adjustForRepeats(string)
                 speech.speak(string)
 
         self.updateBrailleReview()
@@ -2923,7 +2850,7 @@
                 elif clickCount == 3:
                     self.phoneticSpellCurrentItem(string)
                 else:
-                    string = self.adjustForRepeats(string)
+                    string = util.adjustForRepeats(string)
                     speech.speak(string)
 
         self.updateBrailleReview(targetCursorCell)
Index: util.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/util.py,v
retrieving revision 1.40
diff -u -r1.40 util.py
--- util.py	18 Sep 2006 18:31:28 -0000	1.40
+++ util.py	22 Sep 2006 01:16:37 -0000
@@ -46,7 +46,9 @@
 import speech
 import speechserver
 
+from chnames import chnames
 from orca_i18n import _ # for gettext support
+from punctuation_settings import punctuation
 
 def isSameObject(obj1, obj2):
     if (obj1 == obj2):
@@ -541,6 +543,10 @@
             #if string[-1:] == "\n":
             #    string = string[0][:-1]
 
+            string = adjustForRepeats(string)
             yield [speechserver.SayAllContext(obj, string,
                                               startOffset, endOffset),
                    None]
@@ -562,6 +568,77 @@
                 break
         if not moreLines:
             done = True
+
+def _addRepeatSegment(segment, line):
+    """Add in the latest line segment, adjusting for repeat characters
+    and punctuation.
+
+    Arguments:
+    - segment: the segment of repeated characters.
+    - line: the current built-up line to characters to speak.
+
+    Returns: the current built-up line plus the new segment, after
+    adjusting for repeat character counts and punctuation.
+    """
+
+    style = settings.verbalizePunctuationStyle
+    isPunctChar = True
+    try:
+        level, action = punctuation[segment[0]]
+    except:
+        isPunctChar = False
+    count = len(segment)
+    if (count >= settings.repeatCharacterLimit) \
+       and (not segment[0] in string.whitespace) \
+       and (isPunctChar and (style <= level)):
+        if punctuation.has_key(segment[0]):
+            repeatChar = chnames[segment[0]]
+        else:
+            repeatChar = segment[0]
+        line += ' ' + str(count) + ' ' +  repeatChar  + " characters "
+    else:
+        line += segment
+
+    return line
+
+def adjustForRepeats(line):
+    """Adjust line to include repeat character counts.
+    As some people will want this and others might not,
+    there is a setting in settings.py that determines
+    whether this functionality is enabled.
+
+    repeatCharacterLimit = <n>
+
+    If <n> is 0, then there would be no repeat characters.
+    Otherwise <n> would be the number of same characters (or more)
+    in a row that cause the repeat character count output.
+    If the value is set to 1, 2 or 3 then it's treated as if it was
+    zero. In other words, no repeat character count is given.
+
+    Arguments:
+    - line: the string to adjust for repeat character counts.
+
+    Returns: a new line adjusted for repeat character counts (if enabled).
+    """
+
+    if (len(line) < 4) or (settings.repeatCharacterLimit < 4):
+        return line
+
+    newLine = ''
+    segment = lastChar = line[0]
+
+    for i in range(1, len(line)):
+        if line[i] == lastChar:
+            segment += line[i]
+        else:
+            newLine = _addRepeatSegment(segment, newLine)
+            segment = line[i]
+
+        lastChar = line[i]
+
+    newLine = _addRepeatSegment(segment, newLine)
+
+    return newLine
 
 def getLinkIndex(obj, characterIndex):
     """A brute force method to see if an offset is a link.  This
Index: scripts/Evolution.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/scripts/Evolution.py,v
retrieving revision 1.65
diff -u -r1.65 Evolution.py
--- scripts/Evolution.py	21 Sep 2006 14:59:23 -0000	1.65
+++ scripts/Evolution.py	22 Sep 2006 01:16:38 -0000
@@ -340,7 +340,7 @@
             braille.displayMessage(result[0])
             if settings.enableSpeechIndentation:
                 self.speakTextIndentation(event.source, result[0])
-            line = self.adjustForRepeats(result[0])
+            line = util.adjustForRepeats(result[0])
             speech.speak(line)
             return
 
