AlkantarClanX12

Your IP : 18.226.222.132


Current Path : /lib64/python2.7/curses/
Upload File :
Current File : //lib64/python2.7/curses/textpad.pyc

�
|fc@stdZddlZddlZd�Zdd	d��YZedkrpd�Zeje�ZdGe	e�GHndS(
s:Simple textbox editing widget with Emacs-like keybindings.i����NcCs�|j|d|tj||d�|j||dtj||d�|j||dtj||d�|j|d|tj||d�|j||tj�|j||tj�|j||tj�|j||tj	�dS(s^Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    iN(
tvlinetcursest	ACS_VLINEthlinet	ACS_HLINEtaddchtACS_ULCORNERtACS_URCORNERtACS_LRCORNERtACS_LLCORNER(twintulytulxtlrytlrx((s&/usr/lib64/python2.7/curses/textpad.pyt	rectangles%%%%tTextboxcBsSeZdZed�Zd�Zd�Zd�Zd�Zd�Z	dd�ZRS(	sdEditing 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
    cCs?||_||_|j�d|_d|_|jd�dS(Ni(R
tinsert_modet_update_max_yxtstripspacestNonetlastcmdtkeypad(tselfR
R((s&/usr/lib64/python2.7/curses/textpad.pyt__init__+s		
		cCs3|jj�\}}|d|_|d|_dS(Ni(R
tgetmaxyxtmaxytmaxx(RRR((s&/usr/lib64/python2.7/curses/textpad.pyR3s
cCs�|j�|j}xktr�tjj|jj||��tjjkrct|j|d�}Pn|dkrsPn|d}qW|S(suGo to the location of the first blank on the given line,
        returning the index of the last non-blank character.ii(	RRtTrueRtasciiR
tinchtSPtmin(Rtytlast((s&/usr/lib64/python2.7/curses/textpad.pyt_end_of_line8s
		-cCs
|j�|jj�\}}d}x�||jksF||jkr�|jra|jj�}ny|jj|�Wnt	j
k
r�nX|js�t	jj|�r�Pn|}|jj�\}}|dkr(||f}q(q(W|dk	r|jj
|�ndS(N(RR
tgetyxRRRRRRRterrorRtisprinttmove(RtchR!txtbackyxtoldch((s&/usr/lib64/python2.7/curses/textpad.pyt_insert_printable_charFs$
!	cCso|j�|jj�\}}||_tjj|�rk||jksX||jkrk|j	|�qkn|tjj
kr�|jj|d�n�|tjjtj
tjjtjfkrj|dkr�|jj||d�nY|dkr�nJ|jr"|jj|d|j|d��n|jj|d|j�|tjjtjfkrk|jj�qkn|tjjkr�|jj�n�|tjjkr�|jr�|jj||j|��qk|jj||j�n�|tjjtjfkrO||jkr#|jj||d�qk||jkr5qk|jj|dd�n|tjjkredS|tjjkr�|jdkr�dS||jkrk|jj|dd�qkn�|tjjkr|dkr�|j|�dkr�|jj�qk|jj||�|jj�nO|tjjkr>|jj�n-|tjjtjfkr�||jkrk|jj|d|�||j|d�kr�|jj|d|j|d��q�qkn�|tjj kr�|jj!�n�|tjj"tj#fkrk|dkrk|jj|d|�||j|d�krh|jj|d|j|d��qhqkndS(s!Process a single editing command.ii($RR
R$RRRR&RRR,tSOHR'tSTXtKEY_LEFTtBSt
KEY_BACKSPACERR#tdelchtEOTtENQtACKt	KEY_RIGHTtBELtNLtVTtdeletelntclrtoeoltFFtrefreshtSOtKEY_DOWNtSItinsertlntDLEtKEY_UP(RR(R!R)((s&/usr/lib64/python2.7/curses/textpad.pyt
do_command_sr
	*	'	!--cCs�d}|j�x�t|jd�D]�}|jj|d�|j|�}|dkrg|jrgq$nx_t|jd�D]J}|jr�||kr�Pn|tt	j
j
|jj||���}q{W|jdkr$|d}q$q$W|S(s.Collect and return the contents of the window.tiis
(RtrangeRR
R'R#RRtchrRRR(RtresultR!tstopR)((s&/usr/lib64/python2.7/curses/textpad.pytgather�s
/cCsaxT|jj�}|r'||�}n|s3qn|j|�sFPn|jj�qW|j�S(s2Edit in the widget window and collect the results.(R
tgetchRDR=RJ(RtvalidateR(((s&/usr/lib64/python2.7/curses/textpad.pytedit�sN(t__name__t
__module__t__doc__tFalseRRR#R,RDRJRRM(((s&/usr/lib64/python2.7/curses/textpad.pyRs				A	t__main__cCs�d\}}d	\}}|j|d|d�tj||||�}t||d|d||||�|j�t|�j�S(
Ni	iiiisUse Ctrl-G to end editing.i(i	i(ii(taddstrRtnewwinRR=RRM(tstdscrtncolstnlinesRRR
((s&/usr/lib64/python2.7/curses/textpad.pyttest_editbox�s&
sContents of text box:((
RPRtcurses.asciiRRRNRXtwrappertstrtrepr(((s&/usr/lib64/python2.7/curses/textpad.pyt<module>s	
�