Your IP : 13.59.5.179
���]C
� @ sZ d d l Z d d l Z Gd d � d � Z e d k rV d d l Z e j d d d �d S)� Nc @ sf e Z d Z d d g f g Z e j e j d Z d d � Z d d � Z d d
� Z
d d � Z d
S)�
AutoExpandZedit�E_xpand Word�<<expand-word>>�_c C s | j | _ d | _ d S)N)�text�state)�selfZeditwin� r �//opt/alt/python35/lib64/python3.5/AutoExpand.py�__init__ s zAutoExpand.__init__c
C sN | j j d � } | j j d d � } | j sE | j � } d } n? | j \ } } } } | | k sr | | k r� | j � } d } | s� | j j � d S| j � } | j j d t | � d � | | } | d t | � } | d k r� | j j � | j j d | � | j j d � } | j j d d � } | | | | f | _ d S)N�insertzinsert linestartzinsert lineendr �breakzinsert - %d chars� )
r �index�getr �getwordsZbell�getprevword�delete�lenr )
r �eventZ curinsertZcurline�wordsr r �line�wordZnewwordr r r
�expand_word_event$ s.
zAutoExpand.expand_word_eventc C s' | j � } | s g S| j j d d � } t j d | d | � } ~ | j j d d � } t j d | d | � } ~ | r� | r� g Sg } i } | j � x7 | D]/ } | j | � r� q� | j | � | | | <q� Wx7 | D]/ } | j | � r� q� | j | � | | | <q� W| j | � | S)Nz1.0zinsert wordstartz\bz\w+\bzinsert wordend�end)r r r �re�findall�reverse�append) r r ZbeforeZwbefore�afterZwafterr �dict�wr r r
r ? s4
zAutoExpand.getwordsc C sc | j j d d � } t | � } x1 | d k rT | | d | j k rT | d } q$ W| | d � S)Nzinsert linestartr r r )r r r � wordchars)r r �ir r r
r ^ s
&zAutoExpand.getprevwordN)r r )�__name__�
__module__�__qualname__Zmenudefs�string�
ascii_letters�digitsr"