-í
ì¶<c       sŠ     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      sS    t  Z d  Z ' ( d „  Z 1 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    s|   ( ) | |  _  * | 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    s—   1 2 3 |  i } 4 xt 4 d oi 5 t i |  i i | | ƒ ƒ t i j o 6 | d } 7 Pn 8 | d j o 9 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 ƒ  \ } } @ | |  _ A t i | ƒ od B | |  i	 j  p | |  i
 j  o= F y G |  i i | ƒ Wn H t i j
 o
 I n Xn n’J | t i j o K |  i i | d ƒ neL | t i t i t i t i f j oÎ M | d j o N |  i i | | d ƒ nm O | d j o P nV Q |  i o+ R |  i i | d |  i | d ƒ ƒ n T |  i i | d |  i
 ƒ U | t i t i f j o V |  i i ƒ  n noW | t i j o X |  i i ƒ  nHY | t i j oM Z |  i o# [ |  i i | |  i | ƒ ƒ n ] |  i i | |  i
 ƒ nè^ | t i t i f j oi _ | |  i
 j  o ` |  i i | | d ƒ n5 a | |  i	 j o b n d |  i i | d d ƒ nce | t i j o f d SnEg | t i j oS h |  i	 d j o i d Sn2 j | |  i	 j  o k |  i i | d d ƒ n nßl | t i j oN m | d j o |  i | ƒ d j o n |  i i ƒ  n p |  i i ƒ  n~q | t i  j o r |  i i! ƒ  nWs | t i" t i# f j o} t | |  i	 j  of u |  i i | d | ƒ v | |  i | d ƒ j o+ w |  i i | d |  i | d ƒ ƒ n n n¾ x | t i$ j o y |  i i% ƒ  n— z | t i& t i' f j oz { | d j of | |  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   #(+#"&33c    s   ‚ ƒ d } „ xÿ t |  i d ƒ D„ ]ç } … |  i i | d ƒ † |  i | ƒ } ˆ | d j o |  i	 o
 ‰ q& n Š xk t |  i
 d ƒ DŠ ]S } ‹ |  i	 o
 | | j o Œ Pn  | t t i |  i i | | ƒ ƒ ƒ } q’ 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    sœ   ’ “ ” x ” d ot • |  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    s[     ¡ 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   