When the cursor reaches an opening or closing brace { }, square bracket [ ] or parentheses ( ), Padre automatically highlight the pair of the braces.
() # Brackets [] # Square Brackets {} # Braces '' # Single-Quoted String Literals "" # Double-Quoted String Literals
- brace implies (Brackets, Square Brackets & Braces)
Perl -> Find Unmatched Brace (brace)
Initial observations,- works in current editor, does not require the file to be saved :)
- highlights the last unmatched ;-(
- I think it must be counting charter types, with little reference to Perl syntax ;-(
This file passes, this is rubbish ;-((
#!/usr/bin/perl # based on 03_Good_Morning.pl # This file assumes that you already read (and understood) earlier sessions! use strict; # This will be discussed later use warnings; ### line 7 added [ my [( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime( time() ); if ( $hour < 10 ) { print "Good morning!\n"; } elsif {( $hour == 12 ) { print "Out for lunch...\n"; }} ### added {} elsif ( $hour <= 18 ) { print "Hello world!\n"; }] ### line 13 added ] elsif (( $hour < 23 ) { print "Good night.\n"; }) ### added () else { print "sleep well!\n;" }
run against Padre r14200
Opps should have run the Syntax Checker first, or should I
- the editor appears to highlight matching braces in luminous green :)
Edit-> Brace Matching (//brace//) Ctrl+1
- moves the cursor for you
- If the cursor is outside a //brace//, it matches to the outside of it's pair. either forward or backwards :)
- If the cursor is inside a //brace//, it matches to the inside of it's pair. either forward or backwards :)
Q, why is this on the menu and not just a keyboard shortcut!
Edit -> Select To Brace Matching (//brace//) Ctrl+4
- Cool :)
- Inside outside matching //braces// as above, and highlights selection for you :)
- you still need to explicitly copy to place selection on clipboard
- X11 copy don't work
NB the above actions also work with "line 7 added [" & "line 13 added ]" hence we are treating //brace// behind a # comment as active ;-((
Perl -> Find Unmatched Brace (//brace//)
- Checkes for a lone single //brace//
- appears to work, but in following code in stead of highlighting **}**#odd brace not found, highlights my **[**( $sec on the preceding line.
#!/usr/bin/perl # based on 03_Good_Morning.pl # This file assumes that you already read (and understood) earlier sessions! use strict; # This will be discussed later use warnings; ### line 7 added [ my [( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime( time() ); } #odd brace not found if ( $hour < 10 ) { print "Good morning!\n"; } elsif {( $hour == 12 ) { print "Out for lunch...\n"; }} ### added {} elsif ( $hour <= 18 ) { print "Hello world!\n"; }] ### line 13 added ] elsif (( $hour < 23 ) { print "Good night.\n"; }) ### added () else { print "sleep well!\n;" }
- Q are we are using more than one algorithm to do //brace//
Tools -> Preferences -> Behaviour
the image below shows a composite of the pertinent information.
Auto-complete Brackets
When checked, if you type an opening //brace// or String Literal, you get the closing inserted immediately after for you.
Add another closing bracket
appears to be superfluous
TO DO
make this optional, let the user set the colour