Highlight matching parentheses
There are three supported style of paren matching, based loosely
on the Emacs options. The style is select based on the
HILITE_STYLE attribute; it can be changed used the set_style
method.
The supported styles are:
- default
When a right paren is typed, highlight the matching
left paren for 1/2 sec.
- expression
When a right paren is typed, highlight the entire
expression from the left paren to the right paren.
TODO:
- fix interaction with CallTips
- extend IDLE with configuration dialog to change options
- implement rest of Emacs highlight styles (see below)
- print mismatch warning in IDLE status window
Note: In Emacs, there are several styles of highlight where the
matching paren is highlighted whenever the cursor is immediately
to the right of a right paren. I don't know how to do that in Tk,
so I haven't bothered.
Methods
|
|
|
|
__init__
|
__init__ ( self, editwin )
|
|
check_restore_event
|
check_restore_event ( self, event=None )
|
|
create_tag_default
|
create_tag_default ( self, index )
Highlight the single paren that matches
|
|
create_tag_expression
|
create_tag_expression ( self, index )
Highlight the entire expression
|
|
flash_open_paren_event
|
flash_open_paren_event ( self, event )
|
|
handle_restore_timer
|
handle_restore_timer ( self, timer_count )
|
|
set_style
|
set_style ( self, style )
|
|
set_timeout_last
|
set_timeout_last ( self )
The last highlight created will be removed after .5 sec
|
|
set_timeout_none
|
set_timeout_none ( self )
Highlight will remain until user input turns it off
|
|
warn_mismatched
|
warn_mismatched ( self )
|
|