Edit File: textpad.pyc
� ��7ec�����������@���st���d��Z��d�d�l�Z�d�d�l�Z�d����Z�d�d �d�������YZ�e�d�k�rp�d����Z�e�j�e���Z�d�Ge �e���GHn��d�S( ���s:���Simple textbox editing widget with Emacs-like keybindings.i����Nc���������C���s����|��j��|�d�|�t�j�|�|�d���|��j�|�|�d�t�j�|�|�d���|��j�|�|�d�t�j�|�|�d���|��j��|�d�|�t�j�|�|�d���|��j�|�|�t�j���|��j�|�|�t�j���|��j�|�|�t�j���|��j�|�|�t�j ���d�S(���s^���Draw a rectangle with corners at the provided upper-left and lower-right coordinates. i���N( ���t���vlinet���cursest ���ACS_VLINEt���hlinet ���ACS_HLINEt���addcht���ACS_ULCORNERt���ACS_URCORNERt���ACS_LRCORNERt���ACS_LLCORNER(���t���wint���ulyt���ulxt���lryt���lrx(����(����s&���/usr/lib64/python2.7/curses/textpad.pyt ���rectangle���s����%%%%t���Textboxc�����������B���sS���e��Z�d��Z�e�d���Z�d����Z�d����Z�d����Z�d����Z�d����Z �d�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���������C���s?���|�|��_��|�|��_�|��j����d�|��_�d��|��_�|�j�d���d��S(���Ni���(���R ���t���insert_modet���_update_max_yxt���stripspacest���Nonet���lastcmdt���keypad(���t���selfR ���R���(����(����s&���/usr/lib64/python2.7/curses/textpad.pyt���__init__+���s���� c���������C���s3���|��j��j����\�}�}�|�d�|��_�|�d�|��_�d��S(���Ni���(���R ���t���getmaxyxt���maxyt���maxx(���R���R���R���(����(����s&���/usr/lib64/python2.7/curses/textpad.pyR���3���s���� c���������C���s����|��j�����|��j�}�xk�t�r��t�j�j�|��j�j�|�|�����t�j�j�k�rc�t�|��j�|�d���}�Pn�|�d�k�rs�Pn��|�d�}�q�W|�S(���su���Go to the location of the first blank on the given line, returning the index of the last non-blank character.i���i����( ���R���R���t���TrueR���t���asciiR ���t���incht���SPt���min(���R���t���yt���last(����(����s&���/usr/lib64/python2.7/curses/textpad.pyt���_end_of_line8���s���� -c���������C���s ��|��j�����|��j�j����\�}�}�d��}�x��|�|��j�k��sF�|�|��j�k��r��|��j�ra�|��j�j����}�n��y�|��j�j�|���Wn�t �j �k �r��n�X|��j�s��t �j�j�|���r��Pn��|�}�|��j�j����\�}�}�|�d��k�r(�|�|�f�}�q(�q(�W|�d��k �r|��j�j �|����n��d��S(���N(���R���R ���t���getyxR���R���R���R���R���R���R���t���errorR���t���isprintt���move(���R���t���chR!���t���xt���backyxt���oldch(����(����s&���/usr/lib64/python2.7/curses/textpad.pyt���_insert_printable_charF���s$���� ! c���������C���so��|��j�����|��j�j����\�}�}�|�|��_�t�j�j�|���rk�|�|��j�k��sX�|�|��j�k��rk|��j �|���qkn�|�t�j�j �k�r��|��j�j�|�d���n�|�t�j�j�t�j �t�j�j�t�j�f�k�rj|�d�k�r��|��j�j�|�|�d���nY�|�d�k�r��nJ�|��j�r"|��j�j�|�d�|��j�|�d�����n�|��j�j�|�d�|��j���|�t�j�j�t�j�f�k�rk|��j�j����qkn|�t�j�j�k�r�|��j�j����n�|�t�j�j�k�r�|��j�r�|��j�j�|�|��j�|�����qk|��j�j�|�|��j���n�|�t�j�j�t�j�f�k�rO|�|��j�k��r#|��j�j�|�|�d���qk|�|��j�k�r5qk|��j�j�|�d�d���n|�t�j�j�k�red�S|�t�j�j�k�r�|��j�d�k�r�d�S|�|��j�k��rk|��j�j�|�d�d���qkn�|�t�j�j�k�r|�d�k�r�|��j�|���d�k�r�|��j�j����qk|��j�j�|�|���|��j�j����nO|�t�j�j�k�r>|��j�j����n-|�t�j�j�t�j�f�k�r�|�|��j�k��rk|��j�j�|�d�|���|�|��j�|�d���k�r�|��j�j�|�d�|��j�|�d�����q�qkn��|�t�j�j �k�r�|��j�j!����n��|�t�j�j"�t�j#�f�k�rk|�d�k�rk|��j�j�|�d�|���|�|��j�|�d���k�rh|��j�j�|�d�|��j�|�d�����qhqkn��d�S(���s!���Process a single editing command.i����i���($���R���R ���R$���R���R���R���R&���R���R���R,���t���SOHR'���t���STXt���KEY_LEFTt���BSt ���KEY_BACKSPACER���R#���t���delcht���EOTt���ENQt���ACKt ���KEY_RIGHTt���BELt���NLt���VTt���deletelnt���clrtoeolt���FFt���refresht���SOt���KEY_DOWNt���SIt���insertlnt���DLEt���KEY_UP(���R���R(���R!���R)���(����(����s&���/usr/lib64/python2.7/curses/textpad.pyt ���do_command_���sr���� * ' !--c���������C���s����d�}�|��j�����x��t�|��j�d���D]��}�|��j�j�|�d���|��j�|���}�|�d�k�rg�|��j�rg�q$�n��x_�t�|��j�d���D]J�}�|��j�r��|�|�k�r��Pn��|�t�t �j �j �|��j�j�|�|�������}�q{�W|��j�d�k�r$�|�d�}�q$�q$�W|�S(���s.���Collect and return the contents of the window.t����i���i����s��� (���R���t���rangeR���R ���R'���R#���R���R���t���chrR���R���R���(���R���t���resultR!���t���stopR)���(����(����s&���/usr/lib64/python2.7/curses/textpad.pyt���gather����s���� /c���������C���sa���xT�|��j��j����}�|�r'�|�|���}�n��|�s3�q�n��|��j�|���sF�Pn��|��j��j����q�W|��j����S(���s2���Edit in the widget window and collect the results.(���R ���t���getchRD���R=���RJ���(���R���t���validateR(���(����(����s&���/usr/lib64/python2.7/curses/textpad.pyt���edit����s����N(���t���__name__t ���__module__t���__doc__t���FalseR���R���R#���R,���RD���RJ���R���RM���(����(����(����s&���/usr/lib64/python2.7/curses/textpad.pyR������s��� A t���__main__c���������C���s����d�\�}�}�d �\�}�}�|��j��|�d�|�d���t�j�|�|�|�|���}�t�|��|�d�|�d�|�|�|�|���|��j����t�|���j����S( ���Ni ���i���i���i���i���s���Use Ctrl-G to end editing.i���(���i ���i���(���i���i���(���t���addstrR���t���newwinR���R=���R���RM���(���t���stdscrt���ncolst���nlinesR���R���R ���(����(����s&���/usr/lib64/python2.7/curses/textpad.pyt���test_editbox����s����& s���Contents of text box:(����( ���RP���R���t���curses.asciiR���R���RN���RX���t���wrappert���strt���repr(����(����(����s&���/usr/lib64/python2.7/curses/textpad.pyt���<module>���s��� �