Changeset 873


Ignore:
Timestamp:
11/10/08 13:25:10 (3 years ago)
Author:
szabgab
Message:

fix the saving of the new autoindentation preference
implement the three levels of autoindentation

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r864 r873  
    11Changes for Padre. 
     2 
     3    Fix the failing plugin manager test. (SZABGAB) 
     4    Add configuration option to the autoindentation (no, same_level, deep). (SZABGAB) 
     5    Temporarily stop using File::ShareDir::PAR. (SZABGAB) 
    26 
    370.16 2008.11.09 
  • trunk/lib/Padre/Wx/Dialog/Preferences.pm

    r872 r873  
    9494        $config->{$f} = $data->{$f} ? 1 :0; 
    9595    } 
    96     $config->{main_startup}    = $main_startup[ $data->{main_startup} ]; 
     96 
     97    $config->{main_startup}        = $main_startup[ $data->{main_startup} ]; 
     98    $config->{editor_autoindent}   = $editor_autoindent[ $data->{editor_autoindent} ]; 
    9799 
    98100    return; 
  • trunk/lib/Padre/Wx/Editor.pm

    r863 r873  
    304304    my ($self) = @_; 
    305305 
     306    my $config = Padre->ide->config; 
     307    return if not $config->{editor_autoindent} or $config->{editor_autoindent} eq 'no'; 
     308     
    306309    my $pos       = $self->GetCurrentPos; 
    307310    my $prev_line = $self->LineFromPosition($pos) -1; 
     
    313316    my $content   = $self->GetTextRange($start, $end); 
    314317    #print "'$content'\n"; 
     318    my $indent = ''; 
    315319    if ($content =~ /^(\s+)/) { 
    316         my $indent = $1; 
     320        $indent = $1; 
     321    } 
     322    if ($config->{editor_autoindent} eq 'deep' and $content =~ /\{\s*$/) { 
     323        $indent .= "\t"; 
     324    } 
     325    if ($indent ne '') { 
    317326        $self->InsertText($pos, $indent); 
    318327        $self->GotoPos($pos + length($indent)); 
    319328    } 
    320  
     329     
    321330    return; 
    322331} 
Note: See TracChangeset for help on using the changeset viewer.