Index: /branches/1.1dev/lib/SpellCheck.inc.php
===================================================================
--- /branches/1.1dev/lib/SpellCheck.inc.php	(revision 427)
+++ /branches/1.1dev/lib/SpellCheck.inc.php	(revision 428)
@@ -199,7 +199,7 @@
     {
         $corrections = array();
-        // Split words on punctuation except apostrophes
+        // Split words on punctuation except apostrophes (this regex is used in several places in this class).
         // http://stackoverflow.com/questions/790596/split-a-text-into-single-words
-        $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|([\p{Pd}ââ-]+)|(\+|(\p{P}+$))/", $string);
+        $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}ââ-]+|(\p{P}+$))/", $string);
         // Remove non-word elements.
         $words = preg_grep('/\w+/', $words);
@@ -235,5 +235,7 @@
     {
         $errors = array();
-        $words = preg_split('/([\W]+?)/', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
+        // Split words on punctuation except apostrophes (this regex is used in several places in this class).
+        // http://stackoverflow.com/questions/790596/split-a-text-into-single-words
+        $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}ââ-]+|(\p{P}+$))/", $string);
         // Remove non-word elements.
         $check_words = preg_grep('/\w+/', $words);
@@ -265,6 +267,8 @@
      */
     function getStringHighlighted($string, $show_footnote=false)
-    {
-        $words = preg_split('/([\W]+?)/', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
+    { 
+        // Split words on punctuation except apostrophes (this regex is used in several places in this class).
+        // http://stackoverflow.com/questions/790596/split-a-text-into-single-words
+        $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}ââ-]+|(\p{P}+$))/", $string);
         $check_words = preg_grep('/\w+/', $words);
         $cnt = 0;
@@ -272,10 +276,10 @@
             foreach ($check_words as $i => $word) {
                 if (!$this->check($word)) {
-                    $footnote = $show_footnote ? '<sup>' . ++$cnt . '</sup>' : '';
-                	$words[$i] = $this->getParam('highlight_start') . $word . $this->getParam('highlight_end') . $footnote;
-                }
-            }
-        }
-        return join('', $words);
+                    $footnote = $show_footnote ? '<sup style="color:#999;">' . ++$cnt . '</sup>' : '';
+                	$words[$i] = $this->getParam('highlight_start') . strip_tags($word) . $this->getParam('highlight_end') . $footnote;
+                }
+            }
+        }
+        return join(' ', $words);
     }
     
@@ -296,5 +300,5 @@
         <?php
         
-        $form_words = $this->getStringSuggestions(getFormData($form_name));
+        $form_words = array_values($this->getStringSuggestions(getFormData($form_name)));
         if (is_array($form_words) && !empty($form_words)) {
             ?><ol><?php
@@ -302,4 +306,5 @@
                 ?>
                 <li>
+                <label style="color:#999;"><sub style="vertical-align:text-top;"><?php echo $i + 1; ?></sub></label>
                 <select name="spelling_suggestions[<?php echo $form_name ?>][<?php echo $i ?>]" onchange="document.forms[0].elements['spelling_corrections[<?php echo $form_name ?>][<?php echo $i ?>]'].value = this.value;">
                 <?php $original_word = array_shift($words); ?>
@@ -352,5 +357,7 @@
     function applyFormCorrections($form_name)
     {
-        $form_words = preg_split('/([\W]+?)/', getFormData($form_name), -1, PREG_SPLIT_DELIM_CAPTURE);
+        // Split words on punctuation except apostrophes (this regex is used in several places in this class).
+        // http://stackoverflow.com/questions/790596/split-a-text-into-single-words
+        $form_words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}ââ-]+|(\p{P}+$))/", getFormData($form_name));
         $suggestions = getFormData('spelling_suggestions');
         $corrections = getFormData('spelling_corrections');
