Jakub Wilk avatar Jakub Wilk committed c189a6f

Change the code indentation, for consistency with some new code and to save some vertical space.

Comments (0)

Files changed (2)

   * Document the split window feature.
   * Improve error handling.
   * Refactor the language-choosing code.
+  * Change the code indentation, for consistency with some new code and to
+    save some vertical space.
 
- -- Jakub Wilk <jwilk@jwilk.net>  Wed, 27 Feb 2013 23:01:04 +0100
+ -- Jakub Wilk <jwilk@jwilk.net>  Wed, 27 Feb 2013 23:22:11 +0100
 
 irssi-spellcheck (0.5) unstable; urgency=low
 
     return if $word =~ m{^[[:digit:][:punct:]]+$}; # looks like a number
 
     my $ok = $speller{$lang}->check($word);
-    if (not defined $ok)
-    {
+    if (not defined $ok) {
         $win->print('%R' . "Error while spell-checking for $lang" . '%N', MSGLEVEL_CLIENTERROR);
         return;
     }
-    unless ($ok)
-    {
+    unless ($ok) {
         my @result =  map { "$prefix$_$suffix" } $speller{$lang}->suggest($word);
         return \@result;
     }
 
     # possible settings: network/channel/lang  or  channel/lang
     my @languages = split(/[ ,]/, Irssi::settings_get_str('spellcheck_languages'));
-    for my $langstr (@languages)
-    {
+    for my $langstr (@languages) {
         # strip trailing slashes
         $langstr =~ s=/+$==;
         my ($s1, $s2, $s3) = split(/\//, $langstr, 3);
         my ($t, $c, $l);
-        if (defined $s3 && $s3 ne '')
-        {
+        if (defined $s3 && $s3 ne '') {
             # network/channel/lang
             $t = lc($s1); $c = lc($s2); $l = $s3;
-        }
-        else
-        {
+        } else {
             # channel/lang
             $c = lc($s1); $l = $s2;
         }
 
-        if ($c eq $target && (!defined $t || $t eq $network))
-        {
+        if ($c eq $target && (!defined $t || $t eq $network)) {
             return $l;
         }
     }
     my $window_height;
 
     my $window_name = Irssi::settings_get_str('spellcheck_window_name');
-    if ($window_name ne '')
-    {
+    if ($window_name ne '') {
         $correction_window = Irssi::window_find_name($window_name);
         $window_height = Irssi::settings_get_str('spellcheck_window_height');
     }
     return unless Irssi::settings_get_bool('spellcheck_enabled');
 
     # hide correction window when message is sent
-    if ($key eq 10 && $correction_window)
-    {
+    if ($key eq 10 && $correction_window) {
         $correction_window->command("window hide $window_name");
     }
 
     return unless defined $suggestions;
 
     # show corrections window if hidden
-    if ($correction_window)
-    {
+    if ($correction_window) {
         $win->command("window show $window_name");
         $correction_window->command('window stick off');
         $correction_window->command("window size $window_height");
-    }
-    else
-    {
+    } else {
         $correction_window = $win;
     }
 
 
     $word =~ s/%/%%/g;
     my $color = Irssi::settings_get_str('spellcheck_word_color');
-    if (scalar @$suggestions > 0)
-    {
+    if (scalar @$suggestions > 0) {
         $correction_window->print("Suggestions for $color$word%N - " . join(", ", @$suggestions));
-    }
-    else
-    {
+    } else {
         $correction_window->print("No suggestions for $color$word%N");
     }
 }
     }
 
     $win->print("Adding to $lang dictionary: @args");
-    for my $word (@args)
-    {
+    for my $word (@args) {
         $speller{$lang}->add_to_personal($word);
     }
     my $ok = $speller{$lang}->save_all_word_lists();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.