Showing posts with label aspell. Show all posts
Showing posts with label aspell. Show all posts

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...

2009-04-22

padre does spell check

padre, the perl ide, can now check a text for spelling mistakes. this is done with the padre::plugin::spellcheck plugin. new version 1.0.0 is currently propagating on cpan, and should be available soon.

so, how to use it? the first step (beside installing padre and the plugin) is to enable it. open padre, go to plugins menu, open the plugin manager, then select the spell checking plugin, and click on enable:


(you will notice the nice icon, courtesy of mark james - open-source definitely needs artists besides coders)

of course, this should be done only once. that is, if you already tried this plugin, you don't need to re-enable it. (but if you already tried the plugin, then i can imagine that you're quite familiar with padre, and that you don't need this explanation)

so, the plugin is enabled, and you can now close the plugin manager. open the file that you want to spell check, and just press f7 (which seems to be the standard shortcuts among text processors to launch spell checking). this will check your text, and if there are some mistakes, it will open the following window:



the offending text will be selected. the buttons do what one can expect.

some things to note:
  • only english is supported right now. this will change later on.
  • the add to dictionary is not yet implemented.
  • this plugin is using text::aspell (the perl bindings for aspell) underneath (yes, this means you need to have aspell installed on your machine). in the future, i plan to allow one to change the low-level options of aspell...
  • check spelling a program is not a good idea. however,since aspell supports some filtering modes, i'll investigate them.
and don't forget that you're welcome to join the padre development team! we could use more contributors...