| | |
- ParenMatch
class ParenMatch |
| |
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:
- 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 defined here:
- __init__(self, editwin)
- activate_restore(self)
- create_tag_default(self, indices)
- Highlight the single paren that matches
- create_tag_expression(self, indices)
- Highlight the entire expression
- deactivate_restore(self)
- flash_paren_event(self, event)
- handle_restore_timer(self, timer_count)
- paren_closed_event(self, event)
- restore_event(self, event=None)
- set_style(self, style)
- set_timeout_last(self)
- The last highlight created will be removed after .5 sec
- set_timeout_none(self)
- Highlight will remain until user input turns it off
or the insert has moved
- warn_mismatched(self)
Data and other attributes defined here:
- BELL = True
- FLASH_DELAY = 500
- HILITE_CONFIG = {'background': 'gray', 'foreground': '#000000'}
- RESTORE_SEQUENCES = ('<KeyPress>', '<ButtonPress>', '<Key-Return>', '<Key-BackSpace>')
- RESTORE_VIRTUAL_EVENT_NAME = '<<parenmatch-check-restore>>'
- STYLE = 'expression'
- menudefs = [('edit', [('Show surrounding parens', '<<flash-paren>>')])]
| |