[Svn] r2445 - trunk/roundcubemail/program/steps/mail

trac at roundcube.net trac at roundcube.net
Sat May 2 14:51:29 CEST 2009


Author: alec
Date: 2009-05-02 07:51:29 -0500 (Sat, 02 May 2009)
New Revision: 2445

Modified:
   trunk/roundcubemail/program/steps/mail/spell_pspell.inc
Log:
- limit pspell suggestions for each word


Modified: trunk/roundcubemail/program/steps/mail/spell_pspell.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/spell_pspell.inc	2009-05-02 12:38:23 UTC (rev 2444)
+++ trunk/roundcubemail/program/steps/mail/spell_pspell.inc	2009-05-02 12:51:29 UTC (rev 2445)
@@ -30,6 +30,9 @@
     exit;
 }
 
+// max. number of suggestions for one word
+define('MAX_SUGGESTIONS', 10);
+
 // read input
 $data = file_get_contents('php://input');
 
@@ -55,6 +58,9 @@
     $len  = rc_strlen($word);
     if ($word && $plink && !pspell_check($plink, $word)) {
         $suggestions = pspell_suggest($plink, $word);
+	if (sizeof($suggestions)>10)
+	  $suggestions = array_slice($suggestions, 0, MAX_SUGGESTIONS);
+
         $out .= '<c o="'.$pos.'" l="'.$len.'">';
         $out .= implode("\t", $suggestions);
         $out .= '</c>';

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list