ok
Direktori : /opt/alt/python27/lib64/python2.7/idlelib/ |
Current File : //opt/alt/python27/lib64/python2.7/idlelib/AutoExpand.pyo |
� �[ bc @ sc d Z d d l Z d d l Z d d d � � YZ e d k r_ d d l Z e j d d d �n d S( s[ Complete the current word before the cursor with words in the editor. Each menu selection or shortcut key selection replaces the word with a different word with the same prefix. The search for matches begins before the target and moves toward the top of the editor. It then starts after the cursor and moves down. It then returns to the original word and the cycle starts again. Changing the current text line or leaving the cursor in a different place before requesting the next selection causes AutoExpand to reset its state. This is an extension file and there is only one instance of AutoExpand. i����Nt AutoExpandc B sR e Z d d g f g Z e j e j d Z d � Z d � Z d � Z d � Z RS( t edits E_xpand Words <<expand-word>>t _c C s | j | _ d | _ d S( N( t textt Nonet state( t selft editwin( ( s7 /opt/alt/python27/lib64/python2.7/idlelib/AutoExpand.pyt __init__ s c C sT | j j d � } | j j d d � } | j sE | j � } d } nB | j \ } } } } | | k sr | | k r� | j � } d } n | s� | j j � d S| j � } | j j d t | � d � | | } | d t | � } | d k r| j j � n | j j d | � | j j d � } | j j d d � } | | | | f | _ d S( s1 Replace the current word with the next expansion.t inserts insert linestarts insert lineendi t breaks insert - %d charsi ( R t indext getR t getwordst bellt getprevwordt deletet lenR ( R t eventt curinsertt curlinet wordsR R t linet wordt newword( ( s7 /opt/alt/python27/lib64/python2.7/idlelib/AutoExpand.pyt expand_word_event$ s. c 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 � x: | D]2 } | j | � r� q� n | j | � | | | <q� Wx: | D]2 } | j | � rq� n | j | � | | | <q� W| j | � | S( s? Return a list of words that match the prefix before the cursor.s 1.0s insert wordstarts \bs \w+\bs insert wordendt end( R R R t ret findallt reverset append( R R t beforet wbeforet aftert wafterR t dictt w( ( s7 /opt/alt/python27/lib64/python2.7/idlelib/AutoExpand.pyR ? s4 c C s] | j j d d � } t | � } x1 | d k rT | | d | j k rT | d } q$ W| | S( s) Return the word prefix before the cursor.s insert linestartR i i ( R R R t wordchars( R R t i( ( s7 /opt/alt/python27/lib64/python2.7/idlelib/AutoExpand.pyR ^ s &( s E_xpand Words <<expand-word>>( t __name__t __module__t menudefst stringt ascii_letterst digitsR% R R R R ( ( ( s7 /opt/alt/python27/lib64/python2.7/idlelib/AutoExpand.pyR s t __main__s! idlelib.idle_test.test_autoexpandt verbosityi ( ( t __doc__R* R R R'