-í
ì¶<c       so   d  Z  d k Z d k Z d k Z d „  Z d f  d „  ƒ  YZ e d j o! d „  Z e i e ƒ Z	 e	 GHn d S(   s:   Simple textbox editing widget with Emacs-like keybindings.Nc    sð   |  i | d | t i | | d ƒ |  i | | d t i | | d ƒ |  i | | d t i | | d ƒ |  i | d | t i | | d ƒ |  i
 | | t i ƒ |  i
 | | t i ƒ |  i
 | | t i ƒ |  i
 | | t i ƒ d S(   s   Draw a rectangle.i   N(   s   wins   vlines   ulys   ulxs   cursess	   ACS_VLINEs   lrys   hlines	   ACS_HLINEs   lrxs   addchs   ACS_ULCORNERs   ACS_URCORNERs   ACS_LRCORNERs   ACS_LLCORNER(   s   wins   ulys   ulxs   lrys   lrx(    (    s$   /usr/lib/python2.2/curses/textpad.pys	   rectangle s     %%%%s   Textboxc      s>   t  Z d  Z d „  Z d „  Z d „  Z d „  Z e d „ Z RS(   sd  Editing widget using the interior of a window object.
     Supports the following Emacs-like key bindings:

    Ctrl-A      Go to left edge of window.
    Ctrl-B      Cursor left, wrapping to previous line if appropriate.
    Ctrl-D      Delete character under cursor.
    Ctrl-E      Go to right edge (stripspaces off) or end of line (stripspaces on).
    Ctrl-F      Cursor right, wrapping to next line when appropriate.
    Ctrl-G      Terminate, returning the window contents.
    Ctrl-H      Delete character backward.
    Ctrl-J      Terminate if the window is 1 line, otherwise insert newline.
    Ctrl-K      If line is blank, delete it, otherwise clear to end of line.
    Ctrl-L      Refresh screen.
    Ctrl-N      Cursor down; move down one line.
    Ctrl-O      Insert a blank line at cursor location.
    Ctrl-P      Cursor up; move up one line.

    Move operations do nothing if the cursor is at an edge where the movement
    is not possible.  The following synonyms are supported where possible:

    KEY_LEFT = Ctrl-B, KEY_RIGHT = Ctrl-F, KEY_UP = Ctrl-P, KEY_DOWN = Ctrl-N
    KEY_BACKSPACE = Ctrl-h
    c    sd   | |  _  | i ƒ  \ |  _ |  _ |  i d |  _ |  i d |  _ d |  _ t |  _ | i d ƒ d  S(   Ni   (	   s   wins   selfs   getmaxyxs   maxys   maxxs   stripspacess   Nones   lastcmds   keypad(   s   selfs   win(    (    s$   /usr/lib/python2.2/curses/textpad.pys   __init__( s    			c    ss   |  i } x_ d oW t i |  i i | | ƒ ƒ t i j o | d } Pn | d j o Pn | d } q W| Sd S(   s8   Go to the location of the first blank on the given line.i   i    N(   s   selfs   maxxs   lasts   asciis   wins   inchs   ys   SP(   s   selfs   ys   last(    (    s$   /usr/lib/python2.2/curses/textpad.pys   _end_of_line1 s     	 (
c    s‰  |  i i ƒ  \ } } | |  _ t i | ƒ oU | |  i	 j  p | |  i
 j  o1 y |  i i | ƒ Wn t i j
 o n Xn nÿ| t i j o |  i i | d ƒ nØ| t i t i t i t i f j o³ | d j o |  i i | | d ƒ n^ | d j o nM |  i o( |  i i | d |  i | d ƒ ƒ n |  i i | d |  i
 ƒ | t i t i f j o |  i i ƒ  n n | t i j o |  i i ƒ  nß| t i j oD |  i o  |  i i | |  i | ƒ ƒ n |  i i | |  i
 ƒ n‹| t i t i f j oZ | |  i
 j  o |  i i | | d ƒ n, | |  i	 j o n |  i i | d d ƒ n| t i j o d Sn | t i j oG |  i	 d j o d Sn, | |  i	 j  o |  i i | d d ƒ n n©| t i j oE | d j o |  i | ƒ d j o |  i i ƒ  n |  i i ƒ  nT| t i  j o |  i i! ƒ  n3| t i" t i# f j oq | |  i	 j  o] |  i i | d | ƒ | |  i | d ƒ j o( |  i i | d |  i | d ƒ ƒ n n n© | t i$ j o |  i i% ƒ  nˆ | t i& t i' f j on | d j o] |  i i | d | ƒ | |  i | d ƒ j o( |  i i | d |  i | d ƒ ƒ n n n d Sd S(   s!   Process a single editing command.i    i   N((   s   selfs   wins   getyxs   ys   xs   chs   lastcmds   asciis   isprints   maxys   maxxs   addchs   cursess   errors   SOHs   moves   STXs   KEY_LEFTs   BSs   KEY_BACKSPACEs   stripspacess   _end_of_lines   delchs   EOTs   ENQs   ACKs	   KEY_RIGHTs   BELs   NLs   VTs   deletelns   clrtoeols   FFs   refreshs   SOs   KEY_DOWNs   SIs   insertlns   DLEs   KEY_UP(   s   selfs   chs   ys   x(    (    s$   /usr/lib/python2.2/curses/textpad.pys
   do_command= sv     	 %
(
 #00c    sì   d } xÛ t |  i d ƒ D]Æ } |  i i | d ƒ |  i | ƒ } | d j o |  i	 o q n x_ t |  i
 d ƒ D]J } |  i	 o
 | | j o Pn | t t i |  i i | | ƒ ƒ ƒ } qt W|  i d j o | d } n q W| Sd S(   s.   Collect and return the contents of the window.s    i   i    s   
N(   s   results   ranges   selfs   maxys   ys   wins   moves   _end_of_lines   stops   stripspacess   maxxs   xs   chrs   asciis   inch(   s   selfs   results   ys   xs   stop(    (    s$   /usr/lib/python2.2/curses/textpad.pys   gather s        ,c    su   xd d o\ |  i i ƒ  } | o | | ƒ } n | o q n |  i | ƒ o Pn |  i i ƒ  q W|  i ƒ  Sd S(   s2   Edit in the widget window and collect the results.i   N(   s   selfs   wins   getchs   chs   validates
   do_commands   refreshs   gather(   s   selfs   validates   ch(    (    s$   /usr/lib/python2.2/curses/textpad.pys   edit’ s      (	   s   __name__s
   __module__s   __doc__s   __init__s   _end_of_lines
   do_commands   gathers   Nones   edit(    (    (    s$   /usr/lib/python2.2/curses/textpad.pys   Textbox s    				D	s   __main__c    sL   t  i d d d d ƒ } t |  d d d d ƒ |  i ƒ  t | ƒ i ƒ  Sd  S(   Ni   i	   i   i   i   i   i   (   s   cursess   newwins   wins	   rectangles   stdscrs   refreshs   Textboxs   edit(   s   stdscrs   win(    (    s$   /usr/lib/python2.2/curses/textpad.pys   test_editbox  s    
(
   s   __doc__s   syss   cursess   asciis	   rectangles   Textboxs   __name__s   test_editboxs   wrappers   str(   s   syss   strs   cursess   test_editboxs   asciis	   rectangles   Textbox(    (    s$   /usr/lib/python2.2/curses/textpad.pys   ? s   		