MINI MINI MANI MO
ó
Eì]c        
   @   sƒ   d  Z  d d l Td d l m Z d d l m Z m Z d Z d Z d Z	 d Z
 d Z d Z d Z
 d Z d Z d d d „  ƒ  YZ d S(   sH   
An auto-completion window for IDLE, used by the AutoComplete extension
iÿÿÿÿ(   t   *(   t   MC_SHIFT(   t   COMPLETE_FILESt   COMPLETE_ATTRIBUTESs   <<autocompletewindow-hide>>s
   <FocusOut>s
   <ButtonPress>s   <<autocompletewindow-keypress>>s   <Key>s   <Key-BackSpace>s   <Key-Return>s	   <Key-Tab>s   <Key-Up>s
   <Key-Down>s
   <Key-Home>s	   <Key-End>s   <Key-Prior>s
   <Key-Next>s!   <<autocompletewindow-keyrelease>>s   <KeyRelease>s   <B1-ButtonRelease>s   <Configure>s   <B1-Double-ButtonRelease>t   AutoCompleteWindowc           B   s   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z
 d „  Z d
 „  Z d „  Z RS(   c         C   s¨   | |  _  d  |  _ |  _ |  _ d  |  _ |  _ d  |  _ d  |  _ d  |  _	 d  |  _
 d  |  _ d  |  _ d  |  _
 d  |  _ |  _ |  _ |  _ |  _ |  _ t |  _ d  S(   N(   t   widgett   Nonet   autocompletewindowt   listboxt	   scrollbart   origselforegroundt   origselbackgroundt   completionst   morecompletionst   modet   startt
   startindext   lasttypedstartt   userwantswindowt   hideidt
   keypressidt   listupdateidt   winconfigidt   keyreleaseidt
   doubleclickidt   Falset   lastkey_was_tab(   t   selfR   (    (    s2   /usr/lib64/python2.7/idlelib/AutoCompleteWindow.pyt   __init__   s    								,c         C   sì   t  t |  j ƒ t | ƒ ƒ } d } x1 | | k  rW |  j | | | k rW | d 7} q' W| t |  j ƒ k  r¦ |  j j d |  j | f d |  j t |  j ƒ f ƒ n  | t | ƒ k  rß |  j j d |  j | f | | ƒ n  | |  _ d  S(   Ni    i   s   %s+%dc(   t   mint   lenR   R   t   deleteR   t   insert(   R   t   newstartt   min_lent   i(    (    s2   /usr/lib64/python2.7/idlelib/AutoCompleteWindow.pyt
   _change_start8   s    & c         C   sv   d } t  |  j ƒ } xD | | k r[ | | d } |  j | | k rN | } q | d } q Wt | t  |  j ƒ d ƒ S(   s’   Find the first index in self.completions where completions[i] is
        greater or equal to s, or the last index if there is no such
        one.i    i   i   (   R   R   R   (   R   t   sR#   t   jt   m(    (    s2   /usr/lib64/python2.7/idlelib/AutoCompleteWindow.pyt   _binary_searchE   s     	c   
      C   s5  |  j  | ƒ } |  j | t | ƒ  | k r0 | S| d } t |  j ƒ } xN | | k r™ | | d } |  j | t | ƒ  | k rŒ | } qL | d } qL W| d } | | k r» |  j | S|  j | } |  j | } t t | ƒ t | ƒ ƒ }	 t | ƒ } x. | |	 k  r,| | | | k r,| d 7} qÿ W| |  S(   sÖ   Assuming that s is the prefix of a string in self.completions,
        return the longest string which is a prefix of all the strings which
        s is a prefix of them. If s is not a prefix of a string, return s.i   i   (   R(   R   R   R   (
   R   R%   t   firstR#   R&