Skip to content
Snippets Groups Projects
Commit 6258cd9d authored by Andreas Gohr's avatar Andreas Gohr
Browse files

spellchecker fix for aspell <0.60

darcs-hash:20050701073919-7ad00-524018d3058613591acccea6691e81599e8193fb.gz
parent 493a6929
No related branches found
No related tags found
No related merge requests found
......@@ -72,6 +72,7 @@ class Aspell{
var $jargon = null;
var $encoding = 'iso8859-1';
var $mode = PSPELL_NORMAL;
var $version = 0;
var $args='';
......@@ -195,9 +196,9 @@ class Aspell{
// versions of Aspell.
$tmp = array();
preg_match('/^\@.*Aspell (\d+)\.(\d+).(\d+)/',$out,$tmp);
$version = $tmp[1]*1000 + $tmp[2]*10 + $tmp[3];
$this->version = $tmp[1]*100 + $tmp[2]*10 + $tmp[3];
if ($version <= 603) // version 0.60.3
if ($this->version <= 603) // version 0.60.3
$r = $terse ? "\n*\n\$1" : "\n\$1"; // replacement for broken Aspell
else
$r = $terse ? "\n*\n" : "\n"; // replacement for good Aspell
......
......@@ -165,8 +165,14 @@ function spell_check() {
}
$misspell = true;
$len = utf8_strlen($word);
$data[$lcnt] = utf8_substr_replace($data[$lcnt],spell_formatword($word,$sug),$off, $len);
//aspell < 0.60 returns singlebyte offsets
if($spell->version >= 600){
$len = utf8_strlen($word);
$data[$lcnt] = utf8_substr_replace($data[$lcnt],spell_formatword($word,$sug),$off, $len);
}else{
$len = strlen($word);
$data[$lcnt] = substr_replace($data[$lcnt],spell_formatword($word,$sug),$off, $len);
}
}//end of output parsing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment