Current File : //usr/local/apps/python3/lib/python3.11/idlelib/__pycache__/parenmatch.cpython-311.pyc |
�
�Ke$ � � � d Z ddlmZ ddlmZ dddd�ZdZ G d � d
� � Ze� � � e dk rddl
mZ ed
d�� � dS dS )z�ParenMatch -- for parenthesis matching.
When you hit a right paren, the cursor should move briefly to the left
paren. Paren here is used generically; the matching applies to
parentheses, square brackets, and curly braces.
� )�HyperParser)�idleConf�(�[�{��)�]�}�d c � � e Zd ZdZdZdZd� Zed� � � Zd� Z d� Z
d� Zd � Zd
� Z
dd�Zd
� Zd� Zd� Zd� Zeeeed�Zd� Zd� ZdS )�
ParenMatcha' Highlight matching openers and closers, (), [], and {}.
There are three supported styles of paren matching. When a right
paren (opener) is typed:
opener -- highlight the matching left paren (closer);
parens -- highlight the left and right parens (opener and closer);
expression -- highlight the entire expression from opener to closer.
(For back compatibility, 'default' is a synonym for 'opener').
Flash-delay is the maximum milliseconds the highlighting remains.
Any cursor movement (key press or click) before that removes the
highlight. If flash-delay is 0, there is no maximum.
TODO:
- Augment bell() with mismatch warning in status window.
- Highlight when cursor is moved to the right of a closer.
This might be too expensive to check.
z<<parenmatch-check-restore>>)z
<KeyPress>z
<ButtonPress>z<Key-Return>z<Key-BackSpace>c � � || _ |j | _ |j � | j | j � � d| _ d| _ d S )Nr )�editwin�text�bind�RESTORE_VIRTUAL_EVENT_NAME�
restore_event�counter�is_restore_active)�selfr s �</usr/local/apps/python3/lib/python3.11/idlelib/parenmatch.py�__init__zParenMatch.__init__( sN � �����L�� � ����$�9��,� .� .� .����!"����� c � � t j dddd�� � | _ t j ddddd� � � | _ t j ddd
dd� � � | _ t j t j � � d
� � | _ d S )N�
extensionsr �style�opener)�defaultzflash-delay�inti� )�typer �bell�bool� �hilite)r � GetOption�STYLE�FLASH_DELAY�BELL�GetHighlight�CurrentTheme�
HILITE_CONFIG)�clss r �reloadzParenMatch.reload3 s� � ��&���g�x�A� A� A�� �"�,��\�-�e�C�Q� Q� Q����%��\�&�v�q�J� J� J���$�1�(�2G�2I�2I�2:�<� <����r c �z � | j s3| j D ]"}| j � | j |� � �#d| _ dS dS )z5Activate mechanism to restore text from highlighting.TN)r �RESTORE_SEQUENCESr � event_addr �r �seqs r �activate_restorezParenMatch.activate_restore>