2009-04-29

spell check in padre now supports multiple languages... kinda

reshaping the spellcheck plugin for padre to provide a decent interface was my first goal when i took over its maintenance. fulfilling this goal deserved to bounce plugin version to 1.0.0, but that's not the end of my plans...

therefore, i just released version 1.1.0, allowing to change the dictionary language in the preferences dialog of the plugin. you need to have the wanted dictionary installed (note that you can pick only installed dictionaries), otherwise aspell will not work correctly... of course it won't crash anything, you'll just end up with no suggestion and this sort of things.

so, why am i saying that it kinda supports multiple languages? because there is a bug in the styled text control (aka scintilla aka wx::stc) version (1.70) shipped with wxwidgets 2.8.x, which seems to confuse bytes and chars in unicode texts.

this is easily demonstrated by the following snippet:

#!/usr/bin/perl
use strict;
use warnings;
use Wx ':everything';
use Wx::STC;

my $f = Wx::Frame->new(undef,-1,"test");
my $s = Wx::BoxSizer->new(wxVERTICAL);
my $t1 = Wx::StyledTextCtrl->new($f);
my $t2 = Wx::StyledTextCtrl->new($f);
$s->Add($t1);
$s->Add($t2);
$f->SetSizer($s);

$t1->SetText("cote");
$t2->SetText("côte");
$t1->SetSelection(0,3);
$t2->SetSelection(0,3);

$f->Show;
sub Wx::App::OnInit {1}
Wx::App->new->MainLoop;


this creates a window with 2 stc, one containing ascii text, the other containing unicode text. then we try to select the first 3 characters in both stc. look how the first stc correctly selects 3 chars, while the second selects only 2 of them:


i hope this is fixed in later versions of scintilla - but even if that's the case, it needs to be integrated into wxwidgets... and current development version of wxwidgets (2.9.x) only has version 1.75 included, which is already 18 monthes old... (if anyone is interested to update stc in wxwidgets, i'm sure they will welcome your help)

so, there it is - the plugin supports non-english dictionaries... but cannot spell check non-ascii texts! that's pretty useless, isn't it? :-(

side note: this plugin version is now locale-aware, and inaugurates the era of translated plugins...

No comments:

Post a Comment